Problem: Can’t reset multiple VMs at one time via admin portal​ page based on session duration.
View PowerCLI snippt to reset non responding machines what are stuck in disconnected state for more than a 24 hrs
[code language=”powershell”]
Get-RemoteSession -State Disconnected | ? {$_.duration -like "*day*"} | % {Get-DesktopVM -Name $_.DNSName.Split(".")[0] | Send-VMReset}
[/code]
View PowerCLI snippt to reset non responding machines what are stuck in disconnected state for more than a 9 hrs
[code language=”powershell”]
Get-RemoteSession -State Disconnected | ? {$_.duration -like "*hours*"} | ? {([int]$_.duration.split("hours")[0].trim() -gt 9) } | % {Get-DesktopVM -Name $_.DNSName.Split(".")[0] | Send-VMReset}
[/code]