henrydenhengst

XenApp 6.5 AddWindowsFeatures

May 6th, 2015
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Script       : AddWindowsFeatures.ps1
  2. # Author       : Wilco van Bragt
  3. # Creation Date: 7-7-2011
  4. # Usage        : Add Windows Features for Citrix XenApp 6.5
  5. #**************************************************************************
  6. # Date                         Version      Scripter     Changes
  7. #------------------------------------------------------------------------
  8. # 9:42 7-7-2011             0.1         WvB            Intial Version
  9. #
  10. #
  11. #***************************************************************************
  12. Import-Module ServerManager
  13. if ((Test-Path -path C:\LOG\AddWindowsFeatures.log) -ne $True) {
  14.                         New-Item -ItemType file C:\LOG\AddWindowsFeatures.log
  15.                         }
  16. $file = "C:\LOG\AddWindowsFeatures.log"                
  17. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "XPS-Viewer"}
  18. If ($check.Installed -ne "True") {
  19.         Add-WindowsFeature XPS-Viewer -restart -logPath $File
  20. }
  21. else {
  22.                         add-content -path $file "XPS Viewer already installed"
  23. }
  24.  
  25. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "SNMP-Services"}
  26. If ($check.Installed -ne "True") {
  27.         Add-WindowsFeature SNMP-Services -restart -logPath $File
  28. }
  29. else {
  30.                         add-content -path $file "SNMP Services already installed"
  31. }
  32.  
  33. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "AS-Net-FRAMEWORK"}
  34. If ($check.Installed -ne "True") {
  35.         Add-WindowsFeature AS-Net-FRAMEWORK -restart -logPath $File
  36. }
  37. else {
  38.                         add-content -path $file "Net Framework already installed"
  39. }
  40.  
  41. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "GPMC"}
  42. If ($check.Installed -ne "True") {
  43.         Add-WindowsFeature GPMC -restart -logPath $File
  44. }
  45. else {
  46.                         add-content -path $file "Group Policy Management Viewer already installed"
  47. }
  48.  
  49. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "RSAT-ADDS-Tools"}
  50. If ($check.Installed -ne "True") {
  51.         Add-WindowsFeature RSAT-ADDS-Tools -restart -logPath $File
  52. }
  53. else {
  54.                         add-content -path $file "AD Users and Computers already installed"
  55. }
  56.  
  57. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "Desktop-Experience"}
  58. If ($check.Installed -ne "True") {
  59.         Add-WindowsFeature Desktop-Experience -restart -logPath $File
  60. }
  61. else {
  62.                         add-content -path $file "Desktop Experience already installed"
  63. }
  64.  
  65. $check = Get-WindowsFeature | Where-Object {$_.Name -eq "RDS-RD-SERVER"}
  66. If ($check.Installed -ne "True") {
  67.         Add-WindowsFeature RDS-RD-SERVER -restart -logPath $File
  68. }
  69. else {
  70.                         add-content -path $file "Remote Desktop Session Host already installed"
  71. }
  72. New-Item -ItemType file C:\LOG\CHECK\AddWindowsFeatures.CHK
  73. add-content C:\LOG\ChECK\AddWindowsFeatures.CHK "Windows Features Installed"
  74. restart-computer
  75.  
  76. <# This software / sample code is provided to you “AS IS” with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software / sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software / sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software / sample code. In no event should the software / code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE software / SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the software / code belongs to Citrix, any distribution of the code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code. #>
Advertisement
Add Comment
Please, Sign In to add comment