Citrix XenApp 6.5 Bulk Re-Assign of WorkerGroup

We need to adjust the worker group assignment for about 100+ Appsz.. good luck tomorrow… have fun.. (right… time for some scripting with powershell… you need to have Citrix.XenApp.Commands installed!)

write-host “Loading Citrix Powershell Module: ” -fore yellow -nonewline
Add-PSSnapin Citrix*
write-host “Complete.” -fore green

Write-host “Loading Citrix Applications: ” -fore yellow -nonewline
$apps = Get-XAApplication
write-host $apps.count found -fore green

Foreach ($app in $apps)
{
$appName = $app.Browsername
Write-Host “$appName” -fore yellow -nonewline

If ($app.Enabled)
{
Write-Host “: Processing” -fore green
$app | Set-XAApplication -Enabled $False
$app | Set-XAApplication -WorkerGroupNames “The new WorkerGroup goes here (Get-XAWorkerGroup)”
$app | Set-XAApplication -Enabled $True
}
Else
{
write-host “: Previously disabled, skipping” -fore red
}
}