Quantcast
Channel: Hyper-V forum
Viewing all articles
Browse latest Browse all 19461

Start / Stop of a vm via scheduled task fails when no user is logged on

$
0
0

Hello,

I want to start / stop my two hyper-v virtual machines in a scheduled task. I use Windows Server 2012.

For this purpose I created two cmd-scripts which calls a powershell-script.

vor64.cmd:
chcp 1252
C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -noninteractive -nologo -command "& 'c:\batches\vor64.ps1'"

vor64.ps1
stop-vm -name "vm1" -force
stop-vm -name "vm2" -force

The nach64.cmd/nach64.ps1 looks similar only stop-vm is replaced with start-vm.

The scheduled task are konfigure to run under the administrator-account.

The scripts work fine if I start them via explorer: vm stops and start again.

They will although run fine as a scheduled task if the administrator is logged on while the task is executed. But they will not work if no user is logged on the server console.

Why?

Stefan Westner


Viewing all articles
Browse latest Browse all 19461

Trending Articles