Skip to main content

PowerShell Quick Commands

Every command from this collection needs to be run on one of the Delivery Controllers.

Turn off Citrix VDI

Add-PSSnapin citrix*
New-BrokerHostingPowerAction -Action TurnOff -MachineName <vdimachinename>

Set maintenance mode

Add-PSSnapin citrix*
Set-BrokerMachineMaintenanceMode -InputObject <domain>\<vdimachinename> $true

Get VDI details by desktop group

Add-PSSnapin citrix*
Get-BrokerDesktop -Filter {DesktopGroupName -like <vdimachinename>} -MaxRecordCount 100000 | Select-Object DesktopGroupName, MachineName, LastConnectionTime, InMaintenanceMode, @{l="AssociatedUserNames";e={$_.AssociatedUserNames -join ","}}

Delete old resources

Add-PSSnapin citrix*

$oldDevices = Get-BrokerDesktop | where {$_.MachineName -like "S-*"}

Foreach($oldDevice in $oldDevices){
    Remove-BrokerMachine $olddevice.machinename -DesktopGroup $olddevice.desktopgroupname
    Remove-BrokerMachine -inputobject $olddevice.machinename -Force
}