Citrix VDA Goes Bad. Now What?

2 min read
Citrix VDA Goes Bad. Now What?
How to quickly get rid of a Citrix VDA that has died for any reason.

Sometimes Things Don’t Workout

So now your running a nice Delivery Group full of Windows Server OS machines. They might be providing applications or desktops or a mix of both. Then one of the machines dies.

First of all don’t panic. Lets also take some quick corrective action. Here’s the things we should consider doing to this Citrix VDA:

  • Send logoff, disconnect, and hide each Citrix Session found on this VDA.
  • Set the VDA into Maintenance Mode.

The key to these steps is to hide each Citrix Session. This, even if logoff or disconnect fail, will remove the users chance to return to this broken session and when the same thing is launched anew in StoreFront they will not return to this session since it is hidden.

Fast Recovery is Key

Below you’ll find the PowerShell file to make this happen. Be sure to change the site variable and domain name at the top to your Delivery Controller for the given Citrix Site plus your domain and your ready to go.

Based on what Hypervisor your using after taking the above steps you may want to force power off and back on the Citrix VDA, wait for it to power on, verify it has registered with the Citrix Site and Delivery Group, then take the machine out of Maintenance to allow new connections.

Best Regards
Michael Wood


#------------------Display Banner-------------------------

Clear-Host
Write-Host "-------" -NoNewLine
Write-Host "Citrix PowerTools" -Foreground Cyan -NoNewLine
Write-Host "-------"
Write-Host ""
Write-Host "Server Stop and Hide User Sessions + Maintenance Mode" -ForegroundColor Cyan
Write-Host""
Write-Host "Why would you want to do this?" -ForegroundColor Yellow
Write-Host "Sometimes a server, vda,  will continue to show active"
Write-Host "sessions in Citrix Studio or Director after a machine"
Write-Host "failure. Possible a lost network connector or anything."
Write-Host""
Write-Host "Taking this action will hide all of the VDA sessions"
Write-Host "and put the machine in maintenance, preventing new users"
Write-Host "and existing users from connecting to it again."
Write-Host""
Write-Host "You can still see the user sessions in Citrix Studio and"
Write-Host "Director but you'll notice in Director it says:"
Write-Host "No details available." -ForegroundColor Yellow
Write-Host""
Write-Host "This lets you know the sessions are hidden."
Write-Host""

$VDANumber = Read-Host "Enter VDA Name (ie: VTLWCTXVDAP000) or Q to exit"
If ($VDANumber -eq "q"){exit}
Add-PSSnapin Citrix*

$VDA = "LCMCHealth\" + $VDANumber
Get-BrokerSession -MachineName $VDA | Set-BrokerSession -Hidden:$true
Set-BrokerMachineMaintenanceMode -InputObject $VDA $true

Clear-Host
Write-Host "-------" -NoNewLine
Write-Host "Citrix PowerTools" -Foreground Cyan -NoNewLine
Write-Host "-------"
$Maintenance = Get-BrokerMachine -MachineName $VDA | Select-Object MachineName,InMaintenanceMode | Format-List
$Maintenance
Write-Host "Results for Sessions on $VDANumber" -ForegroundColor Cyan
Write-Host "--------------------------------------------"
$Session = Get-BrokerSession -MachineName $VDA | Select-Object BrokeringUserName,Hidden | Format-List
If ($Session -eq $Null) {Write-Host "No session found for $VDANumber!" -ForegroundColor Red}
$Session
Write-Host "--------------------------------------------"
Write-Host ""

Write-Host "Done!" -ForegroundColor Green
pause
Virtualize Brief


Follow