If you need to script the creation of worker groups or if you prefer to work from the command line then the same can be achieved using PowerShell. In the example code we first test to see if the required snapin is loaded, if it is not then we load the snap in. The worker group is created with the cmdlet New-XAWorkerGroup and will initially include the XenApp servers XA1 and XA2. We then add a new server to the group and, finally, see how we can delete the group.
if ( (Get-PSSnapin -Name Citrix.XenApp.Commands -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Citrix.XenApp.Commands
} New-XAWorkerGroup -WorkerGroupName "All Servers" -ServerNames XA1,XA2
To add additional servers to the worker group later we can use Set-XAWorkergroup:
Set-XAWorkerGroup "All Servers" -ServerNames XA1,XA2,XA3
The issue you may have identified with adding to the member list of the Worker Group is that we have to reenter the existing names. To make life easier Citrix have a couple of cmdlets to help
- Add-XAWorkerGroupServer
- Remove-XaWorkergroupServer
Don’t be concerned to much by the names, they can work with servers, server groups and OUs when adding and removing entries from the worker group.
New-XAWorkerGroup Sales -ServerNames XA1
Add-XAWorkerGroupServer Sales -ServerGroups ExampleBRMServers
The worker group Sales now is poplulated with eh farm server XA1 and the servers that belong to the goup, BRMServers.
If it is required to delete a Worker Group then with PowerShell we could issue the following command:
Remove-XAWorkerGroup “All Servers”