-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication-info.ps1
81 lines (60 loc) · 3.55 KB
/
application-info.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
##################
<#
.DESCRIPTION
Script to get published application information - AppName, Delivery Group it is in, Associated Users for the app, the servers that are in the Delivery Group
May not be 100% accruate if you are using Application Groups with Tags to launch from specific servers.
.NOTES
+---------------------------------------------------------------------------------------------+
| Citrix Published App Information |
+---------------------------------------------------------------------------------------------+
| DATE : 28/11/2020
| AUTHOR : rslw.xyz
+---------------------------------------------------------------------------------------------+
#>
Add-PSSnapin Citrix.*
$dgs = Get-BrokerDesktopGroup
$CObj = $null
$CObj = @()
$localTime = Get-Date
$UtcTime = $localTime.ToUniversalTime()
$Date = '{0:dd-MM-yyyy HH:mm}' -f $UtcTime
ForEach($dg in $dgs){
$apps = Get-BrokerApplication -AssociatedDesktopGroupUid $dg.Uid
ForEach($app in $apps){
[String]$AssocUN = get-BrokerApplication -Uid $app.Uid | Select-Object -ExpandProperty AssociatedUserNames
$adgUids = @()
$adgUids = $app.AssociatedDesktopGroupUids
ForEach($adgUid in $adgUids){
[String]$dgName = Get-BrokerDesktopGroup -Uid $adgUid | Select-Object -ExpandProperty Name
$Obj = New-Object psobject
if($AssocUN -eq ""){
$DGUsers = (Get-BrokerAccessPolicyRule -AllowedConnections ViaAG -DesktopGroupUid $adgUid | Select-Object -ExpandProperty IncludedUsers).name
$DGServers = (Get-BrokerMachine -DesktopGroupUid $adgUid).MachineName
$Obj | Add-Member -Name ReportTime -MemberType NoteProperty -Value $Date
$Obj | Add-Member -MemberType NoteProperty -Name AppName -value $app.ApplicationName
$Obj | Add-Member -MemberType NoteProperty -Name PublishedName -value $app.PublishedName
$Obj | Add-Member -MemberType NoteProperty -Name AssociatedUsers -value ($DGUsers -join ",")
$Obj | Add-Member -MemberType NoteProperty -Name AppExe -value $app.CommandLineExecutable
$Obj | Add-Member -MemberType NoteProperty -Name AppCmdLine -value $app.CommandLineArguments
$Obj | Add-Member -MemberType NoteProperty -Name AppWorkDir -value $app.WorkingDirectory
$Obj | Add-Member -MemberType NoteProperty -Name AppDeliveryGroup -value $dgName
$Obj | Add-Member -MemberType NoteProperty -Name DeliveryGroupServers -value ($DGServers -join ",")
$CObj += $Obj
}
else {
$DGServers = (Get-BrokerMachine -DesktopGroupUid $adgUid).MachineName
$Obj | Add-Member -Name ReportTime -MemberType NoteProperty -Value $Date
$Obj | Add-Member -MemberType NoteProperty -Name AppName -value $app.ApplicationName
$Obj | Add-Member -MemberType NoteProperty -Name PublishedName -value $app.PublishedName
$Obj | Add-Member -MemberType NoteProperty -Name AssociatedUsers -value $AssocUN
$Obj | Add-Member -MemberType NoteProperty -Name AppExe -value $app.CommandLineExecutable
$Obj | Add-Member -MemberType NoteProperty -Name AppCmdLine -value $app.CommandLineArguments
$Obj | Add-Member -MemberType NoteProperty -Name AppWorkDir -value $app.WorkingDirectory
$Obj | Add-Member -MemberType NoteProperty -Name AppDeliveryGroup -value $dgName
$Obj | Add-Member -MemberType NoteProperty -Name DeliveryGroupServers -value ($DGServers -join ",")
$CObj += $Obj
}
}
}
}
$CObj | Export-csv D:\citrix_applicationpermissions.csv -NoTypeInformation -Append