VMware View Reset DesktopVM via Powershell

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

Get-RemoteSession -State Disconnected | ? {$_.duration -like "*day*"} | % {Get-DesktopVM -Name $_.DNSName.Split(".")[0] | Send-VMReset}

View PowerCLI snippt to reset non responding machines what are stuck in disconnected state for more than a 9 hrs

Get-RemoteSession -State Disconnected | ? {$_.duration -like "*hours*"} | ? {([int]$_.duration.split("hours")[0].trim() -gt 9) } | % {Get-DesktopVM -Name $_.DNSName.Split(".")[0] | Send-VMReset}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s