daily pastebin goal
34%
SHARE
TWEET

PS-XenAppBuils.ps1

alcaron Feb 18th, 2014 69 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. $ConfigData = @{
  2.     AllNodes = @(
  3.         @{
  4.             NodeName = "localhost"
  5.             Role = "local"
  6.         },
  7.         @{
  8.             NodeName = "<guid1>"
  9.             Role = "XenAppProd"
  10.         }
  11.         @{
  12.             NodeName = "<guid2>"
  13.             Role = "XenAppQA"
  14.         }
  15.         @{
  16.             NodeName = "<guid3>"
  17.             Role = "XenAppPKG"
  18.         }
  19.     );
  20. }
  21.  
  22. Configuration AppV {
  23.     Import-DscResource -Module zAppVImport
  24.     Node $AllNodes.Where{$_.Role -like "XenAppPKG" }.NodeName {
  25.         File Test {
  26.             Ensure = "Present"
  27.             DestinationPath = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules"
  28.             SourcePath = "\\<dscserver>\DSC\Modules"
  29.             Recurse = "True"
  30.             Type = "Directory"
  31.             Force = "True"
  32.         }
  33.  
  34.         Package Install {
  35.             Ensure = "Present"
  36.             Path = "\\<appvserver>\Client\appv_client_rds_MSI_x64.msi"
  37.             Arguments = "AcceptEULA=1 /qb"
  38.             Name = "Microsoft Application Virtualization (App-V) Client for Remote Desktop Services 5.0 Service Pack 2 x64"
  39.             ProductId = "F4BCB831-E3ED-4A05-81C5-E342E22B9E2C"
  40.         }
  41.  
  42.         # Enable Shared Content Store Mode.
  43.         Registry SCS {
  44.             Ensure = "Present"
  45.             Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\Client\Streaming"
  46.             ValueName = "SharedContentStoreMode"
  47.             ValueData = "1"
  48.             ValueType = "Dword"
  49.         }
  50.  
  51.         # Restart App-V Service.
  52.         Script AppVRestart {
  53.             SetScript = { Restart-Service AppvClient }
  54.             GetScript = { return @{Service = (Get-Service -Name AppvClient).Status} }
  55.             TestScript = { if((Get-Service -Name AppvClient).Status -eq "Running"){ $false } }
  56.         }
  57.  
  58.         # Get rid of "Click here..." language bar.
  59.         Registry Seamless {
  60.             Ensure = "Present"
  61.             Key = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Citrix\wfshell\TWI"
  62.             ValueName = "SeamlessFlags"
  63.             ValueData = "262144"
  64.             ValueType = "Dword"
  65.         }
  66.        
  67.         # Import sequences.
  68.         zAppVImport SP2 {
  69.             Ensure = "Present"
  70.             Path = "\\<appvserver>\Content\SP2"
  71.             Single = $false
  72.         }
  73.  
  74.         zAppVImport x64 {
  75.             Ensure = "Present"
  76.             Path = "\\<appvserver>\Content\x64"
  77.             Single = $false
  78.         }
  79.  
  80.         # "Install" legacy apps.
  81.         File <appname> {
  82.             Ensure = "Present"
  83.             SourcePath = "\\<server>\<path\to\files>\"
  84.             DestinationPath = "C:\Program Files\<dest>"
  85.             Recurse = $true
  86.         }
  87.  
  88.         File <appname> {
  89.             Ensure = "Present"
  90.             SourcePath = "\\<dscserver>\DSC\Assets\<appname>\"
  91.             DestinationPath = "C:\<dest>"
  92.             Recurse = $true
  93.         }
  94.  
  95.         Script <appname> {
  96.             SetScript = { & icacls "C:\<dest>" /grant USERS:'(OI)(CI)F' }
  97.             GetScript = { return @{Rights = (Get-ACL "C:\<dest>")} }
  98.             TestScript = {
  99.                 $rights = Get-Acl "C:\<dest>"
  100.                 $value = $false
  101.                 foreach($perms in $rights.Access) {
  102.                     if($perms.IdentityReference.ToString() -eq "BUILTIN\Users" -and $perms.FileSystemRights.ToString() -eq "FullControl" -and $perms.AccessControlType.ToString() -eq "Allow") {
  103.                         $value = $true
  104.                     }
  105.                 }
  106.                 $value
  107.             }
  108.             DependsOn = "[File]<appname>"
  109.         }
  110.     }
  111. }
  112.  
  113. Remove-Item -Path "C:\Program Files\WindowsPowerShell\DscService\Configuration\*.checksum" -Force -Confirm:$false
  114. AppV -OutputPath "C:\Program Files\WindowsPowerShell\DscService\Configuration" -ConfigurationData $ConfigData
  115. New-DSCCheckSum "C:\Program Files\WindowsPowerShell\DscService\Configuration"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top