<# =======================================================================
File Name: ExportDeliveryGroupApps_v01.ps1
Author: citrixpedia@gmail.com
Date: 25-nov-2014
Comments: Script developed to get all apps information for each Delivery Group and dump this info in a different csv file.
======================================================================= #>
#-------------------------------------
# Get Location of script
#-------------------------------------
Get-pssnapin -registered | add-pssnapin -passthru
Get-Location | ForEach-Object { $myPath = $_.Path }
$myDate = Get-Date -UFormat "%Y-%m-%d %H%M"
#--------------------------------------------------------------------------------------------------
# Create a "....DeliveryGroups.csv" file with a list of all delivery groups and users permissions
#--------------------------------------------------------------------------------------------------
$myFileName = $myPath + "\" + $myDate + "_DeliveryGroups.csv"
$header = "DeliveryName,UUId,ColorDepth,Enabled,NumPublishedApplications,IncludedUsers"
$header | Out-File $myFileName -encoding ASCII
Get-BrokerDesktopGroup | Where-Object {$_.Enabled -eq "True"} | ForEach-Object {
if ($_.Name) { $myDesktopGroupName = $_.Name }
$myString = $_.Name + "," + $_.UUId + "," + $_.ColorDepth + "," + $_.Enabled + "," + $_.TotalApplications
#--------------------------------------------------------------------------------------------------
# Get-BrokerAccessPolicyRule -> this CMDLET permits get access permissions
#--------------------------------------------------------------------------------------------------
Get-BrokerAccessPolicyRule | Where-Object { $_.uid -eq "1" -and $_.DesktopGroupName -eq $myDesktopGroupName } | ForEach-Object {
if ($_.IncludedUsers) { $myIncludedUsers = $_.IncludedUsers }
}
$myUsers = ""
$myIncludedUsers | ForEach-Object {
if ($_.Name -and $myUsers) {$myUsers = $myUsers + "," + $_.Name}
elseif ($_.Name -and -not $myUsers) {$myUsers = $_.Name}
}
$myString + ";" + $myUsers | Add-Content $myFileName
}
#----------------------------------------------------------------------------------------------------------------
# Create a "....<delivery_group_name>_DeliveryGroupApps.csv" file with a list of all apps for each delivery group
# UUID is the attribute to identify and link apps and delivery groups
#----------------------------------------------------------------------------------------------------------------
Get-BrokerDesktopGroup | Where-Object {$_.Enabled -eq "True"} | ForEach-Object {
$myUUID= $_.UUID
$myFileName = $myPath + "\" + $myDate + "_" + $_.name + "_DeliveryGroupApps.csv"
$myHeader = "AdminFolderName,ApplicationName,AssociatedUserFullNames,ApplicationType,DisplayName,ClientFolder,CommandLineArguments,CommandLineExecutable,AppName,PublishedName,Visible,WaitForPrinterCreation,WorkingDirectory"
$myHeader | Out-File $myFileName -encoding ASCII
$apps = Get-BrokerApplication -SortBy Name | Where-Object { $_.AssociatedDesktopGroupUUIDs -eq $myUUID }
Foreach ($app in $apps) {
$myString = $app.AdminFolderName + "," + $app.ApplicationName + "," + $app.AssociatedUserFullNames + "," + $app.ApplicationType + "," + $app.BrowserName + "," + $app.ClientFolder + "," + $app.CommandLineArguments + "," + $app.CommandLineExecutable + "," + $app.Name + "," + $app.PublishedName + "," + $app.Visible + "," + $app.WaitForPrinterCreation + "," + $app.WorkingDirectory
$myString | Add-Content $myFileName
}
}
Get-ChildItem -Filter *_DeliveryGroupApps.csv | Select-Object -ExpandProperty FullName | Import-Csv | Export-Csv (".\_AvailableApps" + $mydate + ".csv") -NoTypeInformation
#Delete
Remove-Item (".\" + $mydate + "*.csv")
Like this:
Like Loading...