Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Shutdown\Startup Guest VM

$
0
0

Windows Server 2008 R2 host running A Hyper-V Windows 2000 Server guest VM.

I am looking for a simple way (either batch, VBS or PowerShell command) to shutdown the guest VM and then start it up at a time of my choosing.

I have installed the "PowerShell Management Library for Hyper-V" and used the following commands with success ONLY after right-clicking PowerShell and selecting "Run as Administrator":

Import-Module "C:\Program Files\modules\HyperV\HyperV.psd1"
shutdown-vm "VM_NAME" -force

However no matter what I do I can not get this run as a scheduled task. it does not error out but it just doesn't run.

I have tried several combinations using the "Start-Process powershell -verb runas" which if I manually type that command into PowerShell will bring up another PowerShell box run in admin context I assume but none of this I can get working with a scheduled task.


Viewing all articles
Browse latest Browse all 6937

Trending Articles