Search Applications by User in XenApp 7.X using Powershell

Like all Citrix Admin’s, I very much miss the feature to Search for list of applications that user has access to in XenApp 7.X Studio or Director.

I wrote a simple Powershell Script to do the same. You can modify it as per your needs.

I have used Quest AD Module to query User’s Group Membership , you could use Powershell cmdlet like Get-AdUser, Get-ADGroupMember or ADSI as well.

Note: This Script will Not search for Applications where “Limit Visibility” (in Published Application Properties) is set to “Show this application to the entire Delivery Group”

Add-PSSnapin citrix*
Import-Module ‘C:\Program Files\Quest Software\Management Shell for AD\Quest.ActiveRoles.ArsPowerShellSnapIn.Utility.dll’
Add-PSSnapin Quest.ActiveRoles.ADManagement
$userfiltercheck= @()

Write-Host “Please Enter the UserID Without Domain name” -ForegroundColor Black -BackgroundColor Red
Write-Host -foregroundcolor Black -backgroundcolor Red “Enter the UserID : ”
$Uname = Read-Host
$Ugroups= Get-QADUser -SamAccountName $Uname | % {$_.MemberOf } | Get-QADGroup | select Name
write-host “Enumerating User Applications. Please wait …..” -ForegroundColor Green

Function applist {

foreach ($application in $applications) {

if ($application.UserFilterEnabled.Equals($false))
{
$global:userfiltercheck += $application.ApplicationName

}

if ($application.AssociatedUserNames -contains “ReplaceWithyourDomainName\”+$Uname)
{
Write-Host $application.ApplicationName ” UserID is directly added into this Application in Studio”
}

}

foreach ($Ugroup in $Ugroups)
{
foreach ($application in $applications)

{
if ($application.AssociatedUserFullNames -contains $Ugroup.Name)
{
write-host $application.ApplicationName
}
}
}
}

$applications = Get-BrokerApplication -AdminAddress ‘DeliveryControllerName_Site1’ -MaxRecordCount 1000
Write-host “Searching For Apps from XYZ Site.. ” -ForegroundColor Green
applist

$applications = Get-BrokerApplication -AdminAddress ‘DeliveryControllerName_Site2’ -MaxRecordCount 1000
Write-host “Searching For Apps from XYZ Site.. ” -ForegroundColor Green
applist

if ($userfiltercheck -ne $null) {
write-host “**Note : Below Applications Inherit User Access from Delivery Group. Please get this changed inorder to search for user access” -ForegroundColor Cyan -BackgroundColor red
Write-Host -Separator `n $userfiltercheck
}
Pause

 

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 )

Facebook photo

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

Connecting to %s