Logging off a user from all current sessions, after sending a warning message
This command displays a warning message to all users whose names start with "fred" before logging them off. Note that in this example there is specified time period (10 seconds) before logoff occurs.
Get-XdVirtualDesktop |
where { $($_.AssignedUserName -match 'fred')
-and $( $_.PowerState -eq 'Suspended') } | Resume-XdVirtualDesktop
If the VMs were shut down as opposed to suspended, use the following command to restart those VMs:
Get-XdVirtualDesktop |
where { $($_.AssignedUserName -match 'fred') } | `
foreach { switch ($_.PowerState) { 'Suspended' { Resume-XdVirtualDesktop $_ }
'Off' { Start- XdVirtualDesktop $_ } } }
Comments (1)
Jan 20, 2009
Keith Pasquill says:
Doesn't look to me as if the first example logs anybody off, rather it resumes a...Doesn't look to me as if the first example logs anybody off, rather it resumes any suspended sessions for the user "fred". Please correct me if I am wrong.
Add Comment