Quantcast
Channel: Virtual Server forum
Viewing all articles
Browse latest Browse all 1182

Stop-VM via Powershell on HyperV Host

$
0
0

Hello,

I am trying to shutdown all machines on a VM HOST

$VMnames = get-vm |select-object VMElementName
$VMNames |out-file "C:\Windows\Scripts\VMs.log"
$VMs = get-content -path "C:\Windows\Scripts\VMs.log"
Foreach ($VMname in $VMs)
{
write-output "Reboot VM $VMname" |Out-File "C:\Windows\Scripts\Reboot.log" -Append
Get-Date |Out-File "C:\Windows\Scripts\Reboot.log" -Append
Stop-VM $VMname –Force
}

But this doesnt work whereas STOP-VM <NAME> -Force works

STOP-VM -Name <Name> -Force doesnt work at all

Any Idea? Regards Roman


ooGDoo


Viewing all articles
Browse latest Browse all 1182

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>