Adding Published Applications from a specific Delivery Group to an Application Group (PowerShell)

With XenDesktop 7.12 its possible to tag your Published Applicatons and assign them to an application group. With this feature we get back the control on which server the user session will be established. Many of XenApp IMA administrators have been missing this feature. If you only have a few published apps and one DeliveryGroup its not a big deal to add them to an created application group but what if you only want to add the apps from Delivery Group “Sales”? Its very annoying to select all the applications and assign them to the app group.  Here is a PowerShell script to save you some work 😉

Detailed information about tagging is available from the blog post of Martin Zugec.
How to Assign Applications to Specific Servers in XenApp 7

MoveAppstoApplicationGroup_v1

<#
DESCRIPTION   This script will import all Published Applications from a specific Delivery Group to an Application Group.
Author:         Julian Mooren
Creation Date:  25.05.2017
Purpose/Change: Initial script development
#>

Write-Host "Importing the Citrix Modules..."
asnp Citrix*

$controller = Read-Host -Prompt  "Please enter FQDN of the XDC. Example 'xdc01.domain.local'"

Write-Host "Which Delivery Group should be added?"
$Expand = Read-Host -Prompt  "Name of the Delivery Group. Example 'XenApp7_PROD'"
$ExpandDG = Get-BrokerDesktopGroup -AdminAddress $controller | Where {$_.Name -eq $Expand}

Write-Host "Which Application Group should be added?"
$Import = Read-Host -Prompt "Name of the Application Group. Example: 'AppGroup_V18'"
$ImportAG = Get-BrokerApplicationGroup -AdminAddress $controller | Where {$_.Name -eq $Import}

$PublishedApps = Get-BrokerApplication -AdminAddress $controller | Where {$_.AllAssociatedDesktopGroupUids -like $ExpandDG.UiD}

Foreach($app in $PublishedApps)
{
Write-Host ” –” $app.Name "will be added to " $ImportAG.Name

Add-BrokerApplication  -AdminAddress $controller -ApplicationGroup $ImportAG.Uid -InputObject @($app.Uid)
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: