Skip to content

Instantly share code, notes, and snippets.

@alainassaf
Last active February 14, 2017 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alainassaf/22c433756a49e1bfa669d998e14ba2d9 to your computer and use it in GitHub Desktop.
Save alainassaf/22c433756a49e1bfa669d998e14ba2d9 to your computer and use it in GitHub Desktop.
# Get list of applications
$XAApps = Get-XAApplicationReport -ComputerName $xmlbroker * | where {$_.Enabled -eq $true} | select browsername,accounts
foreach ($app in $XAApps) {
write-verbose $app.browsername
write-verbose (($app.Accounts | select accountname).accountname | out-string)
$isUser = $null
$isGroup = $null
# Application account(s) loop
foreach ($acct in $app.Accounts) {
if ($acct.AccountName -match $accountpattern) {
Write-verbose "$acct is a user account"
$isUser += $acct.AccountName.ToString() + ','
} else {
write-verbose "$acct is an AD group"
if ($acct -match 'Citrix Admins') {
write-verbose "AD Group is Citrix Admins"
} else {
$isGroup += $acct.AccountName.ToString() + ','
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment