Jump to content
  • 0

Script to Identify and Shut Down Disconnected NP VDIs




Looking to find a script that will help me temporarily before I fix this issue properly...


I need to identify all NP VDIs that have disconnected sessions running over 4 hours. Then I need to shut these VDIs down.


Identifying the VDIs with the target sessions is no problem but then invoking a power action is the bit I cant get.  Logging the session off is not an option, I need to shut each target machine down.


Thanks in advance! 

Link to comment

1 answer to this question

Recommended Posts

  • 1

You can use New-BrokerHostingPowerAction to trigger a shutdown.

Identify the target VDI and run New-BrokerHostingPowerAction with it.

For example, you could append this to the last, like this

Get-BrokerDesktop -PowerState On -SummaryState Disconnected | ? {$_.SessionStateChangeTime.AddHours(4) -lt (Get-Date)} | New-BrokerHostingPowerAction -Action Shutdown
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...