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