Skip to content

Commit 23fd9c1

Browse files
Chnage parameter type
1 parent c8c609d commit 23fd9c1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Citrix/Applications/Remove-CTXDesktopGroup.ps1

+15-2
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,33 @@
2929
.Parameter Name
3030
[sr-en] Name of the desktop group
3131
[sr-de] Name der Desktop-Gruppe
32+
33+
.Parameter RemoveAssignedApplications
34+
[sr-en] Remove assigned applications
35+
[sr-de] Zugewiesene Anwendungen löschen
3236
#>
3337

3438
param(
3539
[Parameter(Mandatory = $true)]
3640
[string]$Name,
37-
[string]$SiteServer
41+
[string]$SiteServer,
42+
[bool]$RemoveAssignedApplications
3843
)
3944

4045
$LogID = $null
4146
[bool]$success = $false
4247
try{
4348
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
44-
StartLogging -ServerAddress $SiteServer -LogText "Remove Desktop Group $($Name)" -LoggingID ([ref]$LogID)
4549

50+
if($RemoveAssignedApplications -eq $true){
51+
$deskGrp = Get-BrokerDesktopGroup -Name $Name -AdminAddress $SiteServer
52+
$curApps = Get-BrokerApplication -DesktopGroupUid $deskGrp.Uid -AdminAddress $SiteServer
53+
if ($curApps.Count -gt 0) {
54+
Remove-BrokerApplication -InputObject $curApps -AdminAddress $SiteServer
55+
}
56+
}
57+
58+
StartLogging -ServerAddress $SiteServer -LogText "Remove Desktop Group $($Name)" -LoggingID ([ref]$LogID)
4659
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
4760
'AdminAddress' = $SiteServer
4861
'Name' = $Name

0 commit comments

Comments
 (0)