{"id":1719,"date":"2013-02-18T19:12:08","date_gmt":"2013-02-18T18:12:08","guid":{"rendered":"http:\/\/www.mariotti.de\/?p=1719"},"modified":"2013-02-18T19:12:08","modified_gmt":"2013-02-18T18:12:08","slug":"citrix-xenapp-6-x-per-powershell-konfigurieren","status":"publish","type":"post","link":"https:\/\/dev.mariotti.de\/?p=1719","title":{"rendered":"Citrix XenApp 6.x per PowerShell konfigurieren"},"content":{"rendered":"<p>Das folgende PowerShell Skript zeigt beispielhaft wie Sie eine Citrix XenApp 6.0 oder 6.5 Farm automatisch konfigurieren k\u00f6nnen, und wie Sie Farmobjekte wie Published Applications, Load Evaluatoren, Policies, Worker Groups, etc. automatisiert erstellen k\u00f6nnen.<\/p>\n<p>Weiterf\u00fchrende Informationen finden Sie unter: <a href=\"http:\/\/community.citrix.com\/display\/xa\/XenApp+6+PowerShell+SDK\">http:\/\/community.citrix.com\/display\/xa\/XenApp+6+PowerShell+SDK<\/a><\/p>\n<pre><code class=\"language-powershell\"># Load Snap-in&apos;s\nAdd-PSSnapin Citrix.XenApp.Commands\nAdd-PSSnapin Citrix.Common.Commands\nAdd-PSSnapin Citrix.Common.GroupPolicy\n\n# Create server folders\nNew-XAFolder &quot;Servers\/Controllers&quot; -ErrorAction SilentlyContinue New-XAFolder &quot;Servers\/Workers&quot; -ErrorAction SilentlyContinue\n\n# Move server to server folders (based on computername)\nif ($env:computername -like &quot;XENAPP001&quot; -or $env:computername -like &quot;XENAPP002&quot;) {Move-XAServer $env:computername -ToFolderPath Servers\/Controllers -ErrorAction SilentlyContinue}\nelse {Move-XAServer $env:computername -ToFolderPath Servers\/Workers -ErrorAction SilentlyContinue}\n\n# Set zone preference for primary controller\nif ($env:computername -like &quot;XENAPP001&quot;) {Set-XAServerZone -Servername $env:computername -ElectionPreference MostPreferred}\n\n# Set Zone Preference for backup controller\nif ($env:computername -like &quot;XENAPP002&quot;) {Set-XAServerZone -ServerName $env:computername -ElectionPreference Preferred}\n\n# Create new offline (full load) load evaluator\nNew-XALoadEvaluator &quot;Offline&quot; -Description &quot;Offline&quot; -MondaySchedule 00:00-00:00 -TuesdaySchedule 00:00-00:00 -WednesdaySchedule 00:00-00:00 -ThursdaySchedule 00:00-00:00 -FridaySchedule 00:00-00:00 -SaturdaySchedule 00:00-00:00 -SundaySchedule 00:00-00:00\n\n# Create new custom load evaluator\nNew-XALoadEvaluator &quot;CustomLE1&quot; -Description &quot;CustomLE1&quot; -CpuUtilization 10, 75 -MemoryUsage 10, 75 -ServerUserLoad 20\n\n# Assign load evaluators to servers (NOTE! Only for XenApp 6.0, in newer version this setting is moved to the policy!)\nif ($env:computername -like &quot;XENAPP001&quot; -or $env:computername -like &quot;XENAPP002&quot;) {Set-XAServerLoadEvaluator -LoadEvaluatorName &quot;Offline&quot; $env:computername} else {Set-XAServerLoadEvaluator -LoadEvaluatorName &quot;CustomLE1&quot; $env:computername}\n\n# Add XenApp administrators\nNew-XAAdministrator &quot;YourDomain\\Domain Admins&quot; -AdministratorType Full New-XAAdministrator &quot;YourDomain\\Citrix Admins&quot; -AdministratorType Full New-XAAdministrator &quot;YourDomain\\Citrix Support&quot; -AdministratorType ReadOnly\n\n# Configure edition\nSet-XAServerEdition -Name $env:computername -Edition Enterprise\n\n# Create Application folders\nNew-XAFolder &quot;Applications\/Utilities&quot; New-XAFolder &quot;Applications\/Desktops&quot;\n\n# Create Desktop Publ. App.\nNew-XAApplication -SkipLogOnCheck -SkipPassThru -Force -ApplicationType ServerDesktop -DisplayName &quot;Desktop&quot; -Description &quot;Desktop&quot; -FolderPath &quot;Applications\/Desktops&quot; -ServerNames $env:computername \u2013Accounts &quot;YourDomain\\Domain Admins&quot; -ClientFolder &quot;Desktops&quot; -AddToClientStartMenu $true -WindowType 75%\n\n# Create Internet Explorer Publ.App incl. Custom Icon\nNew-XAApplication -Force -SkipLogOnCheck -SkipPassThru -ApplicationType ServerInstalled -DisplayName &quot;Internet Explorer&quot; -CommandLineExecutable &quot;&quot;&quot;C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE&quot;&quot; https:\/\/dev.mariotti.de\/&quot; -WorkingDirectory &quot;C:\\Program Files\\Internet Explorer&quot; -ServerNames $computername -Description &quot;Internet Explorer&quot; -FolderPath &quot;Applications\/Utilities&quot; -ClientFolder &quot;Pilot&quot; -AddToClientStartMenu $true -AddToClientDesktop $true -Accounts &quot;YourDomain\\Domain Users &quot; -EncodedIconData (Get-CtxIcon &quot;C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE&quot; -index 2)\n\n# Create a policy drive object (to access the policy settings)\nNew-PSDrive -Name LocalFarmGPO -PSProvider CitrixGroupPolicy -FarmGPO $env:Computername -Root \\\n\n# Change some policy settings in the &quot;Unfiltered&quot; policy\nSet-ItemProperty LocalFarmGPO:\\Computer\\Unfiltered\\Settings\\Licensing\\LicenseServerPort Value &quot;27000&quot;\nSet-ItemProperty LocalFarmGPO:\\Computer\\Unfiltered\\Settings\\Licensing\\LicenseServerHostName Value &quot;YourLicenseServer&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Printermapping\\Settings\\ICA\\Printing\\ClientPrinters\\ClientPrinterAutoCreation Value &quot;AllPrinters&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Printermapping\\Settings\\ICA\\Printing\\Drivers\\InboxDriverAutoInstallation State &quot;Disabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Printermapping\\Settings\\ICA\\Printing\\ClientPrinterRedirection State &quot;Enabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Printermapping\\Settings\\ICA\\Printing\\UniversalPrinting\\UniversalPrinting Value &quot;Updonly&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Printermapping\\Settings\\ICA\\Printing\\WaitForPrintersToBeCreated State &quot;Disabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\AutoConnectDrives State &quot;Enabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientDriveRedirection State &quot;Enabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientFloppyDrives State &quot;Disabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientFixedDrives State &quot;Enabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientNetworkDrives State &quot;Enabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientOpticalDrives State &quot;Disabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientRemoveableDrives State &quot;Disabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\FileRedirection\\ClientDriveLetterPreservation State &quot;Enabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\USBDevices\\UsbDeviceRedirection State &quot;Disabled&quot;\nSet-ItemProperty LocalFarmGPO:\\User\\Drivemapping\\Settings\\ICA\\USBDevices\\UsbPlugAndPlayRedirection State &quot;Disabled&quot;\n\n# List all available policy settings (to get an idea what other policy settings can be configured)\nGet-ChildItem LocalFarmGPO:\\Computer\\Unfiltered \u2013Recurse Get-ChildItem LocalFarmGPO:\\User\\Unfiltered -Recurse\n\n# Create a worker group and assign a server\nNew-XAWorkerGroup -WorkerGroupName &quot;WorkerGroupWithServer&quot; -Description &quot;WorkerGroupWithServer&quot; -ErrorAction SilentlyContinue\nAdd-XAWorkerGroupServer &quot;WorkerGroupWithServer&quot; -ServerNames $env:computername\n\n# Create a worker group with AD OU assignment\nNew-XAWorkerGroup -WorkerGroupName &quot;WorkerGroupWithOU&quot; -Description &quot;WorkerGroupWithOU&quot; -OUs &apos;OU=XenApp Server,DC=YourSubDomain,DC=YourTopLevelDomain&apos; -ErrorAction SilentlyContinue\n\n# Assign a worker group to all publ. apps\nGet-XAApplication -FolderPath &quot;Applications&quot; | set-XAApplication -WorkerGroupNames &quot;WorkerGroupWithServer&quot;\n\n# Create a new custom policy including a filter\nNew-Item &quot;LocalFarmGPO:\\Computer\\CustomPolicy1&quot; -ErrorAction SilentlyContinue\nNew-Item -Path &quot;LocalFarmGPO:\\Computer\\CustomPolicy1\\Filters\\Workergroup&quot; -value &quot;WorkerGroupWithServer&quot; -Type &quot;Workergroup&quot; -ErrorAction SilentlyContinue\nSet-ItemProperty &quot;LocalFarmGPO:\\Computer\\CustomPolicy1\\Settings\\ICA\\Shadowing\\Shadowing&quot; State &quot;Enabled&quot;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In diesem Beitrag zeige ich ein beispielhaftes PowerShell Skript zum automatischen Citrix XenApp 6.0\/6.5 Farm Konfiguration incl. Farm Einstellungen, Published Applications, Load Evaluatoren, Policies, Worker Groups, etc. <\/p>\n","protected":false},"author":2,"featured_media":2347,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,37],"tags":[],"class_list":["post-1719","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-citrix","category-powershell"],"_links":{"self":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts\/1719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1719"}],"version-history":[{"count":0,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts\/1719\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/media\/2347"}],"wp:attachment":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}