Reputation: 767
I would like to ask how to find all VM/Hyper-V on Window Server 2012 with the use of power-shell and then restart/reboot them with the use of power-shell script?
The next thing is:
I cannot even find any get command for it:
================== Added in 2014-08-15 have find a reference link that help me a lot, just share here http://technet.microsoft.com/en-us/library/hh848479.aspx
Upvotes: 0
Views: 1282
Reputation: 165
Run Powershell elevated (!) and execute following:
ForEach ($VM in Hyper-V\Get-VM | Where {$_.State -ne "Off") {
Restart-Computer -ComputerName $VM.Name
}
Non-elevated Powershell will not return any results.
Martin
Upvotes: 1