Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ConfigData = @{
- AllNodes = @(
- @{
- NodeName = "localhost"
- Role = "local"
- },
- @{
- NodeName = "<guid1>"
- Role = "XenAppProd"
- }
- @{
- NodeName = "<guid2>"
- Role = "XenAppQA"
- }
- @{
- NodeName = "<guid3>"
- Role = "XenAppPKG"
- }
- );
- }
- Configuration AppV {
- Import-DscResource -Module zAppVImport
- Node $AllNodes.Where{$_.Role -like "XenAppPKG" }.NodeName {
- File Test {
- Ensure = "Present"
- DestinationPath = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules"
- SourcePath = "\\<dscserver>\DSC\Modules"
- Recurse = "True"
- Type = "Directory"
- Force = "True"
- }
- Package Install {
- Ensure = "Present"
- Path = "\\<appvserver>\Client\appv_client_rds_MSI_x64.msi"
- Arguments = "AcceptEULA=1 /qb"
- Name = "Microsoft Application Virtualization (App-V) Client for Remote Desktop Services 5.0 Service Pack 2 x64"
- ProductId = "F4BCB831-E3ED-4A05-81C5-E342E22B9E2C"
- }
- # Enable Shared Content Store Mode.
- Registry SCS {
- Ensure = "Present"
- Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\Client\Streaming"
- ValueName = "SharedContentStoreMode"
- ValueData = "1"
- ValueType = "Dword"
- }
- # Restart App-V Service.
- Script AppVRestart {
- SetScript = { Restart-Service AppvClient }
- GetScript = { return @{Service = (Get-Service -Name AppvClient).Status} }
- TestScript = { if((Get-Service -Name AppvClient).Status -eq "Running"){ $false } }
- }
- # Get rid of "Click here..." language bar.
- Registry Seamless {
- Ensure = "Present"
- Key = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Citrix\wfshell\TWI"
- ValueName = "SeamlessFlags"
- ValueData = "262144"
- ValueType = "Dword"
- }
- # Import sequences.
- zAppVImport SP2 {
- Ensure = "Present"
- Path = "\\<appvserver>\Content\SP2"
- Single = $false
- }
- zAppVImport x64 {
- Ensure = "Present"
- Path = "\\<appvserver>\Content\x64"
- Single = $false
- }
- # "Install" legacy apps.
- File <appname> {
- Ensure = "Present"
- SourcePath = "\\<server>\<path\to\files>\"
- DestinationPath = "C:\Program Files\<dest>"
- Recurse = $true
- }
- File <appname> {
- Ensure = "Present"
- SourcePath = "\\<dscserver>\DSC\Assets\<appname>\"
- DestinationPath = "C:\<dest>"
- Recurse = $true
- }
- Script <appname> {
- SetScript = { & icacls "C:\<dest>" /grant USERS:'(OI)(CI)F' }
- GetScript = { return @{Rights = (Get-ACL "C:\<dest>")} }
- TestScript = {
- $rights = Get-Acl "C:\<dest>"
- $value = $false
- foreach($perms in $rights.Access) {
- if($perms.IdentityReference.ToString() -eq "BUILTIN\Users" -and $perms.FileSystemRights.ToString() -eq "FullControl" -and $perms.AccessControlType.ToString() -eq "Allow") {
- $value = $true
- }
- }
- $value
- }
- DependsOn = "[File]<appname>"
- }
- }
- }
- Remove-Item -Path "C:\Program Files\WindowsPowerShell\DscService\Configuration\*.checksum" -Force -Confirm:$false
- AppV -OutputPath "C:\Program Files\WindowsPowerShell\DscService\Configuration" -ConfigurationData $ConfigData
- New-DSCCheckSum "C:\Program Files\WindowsPowerShell\DscService\Configuration"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement