imacomputa
Contributor
Contributor

Can't run "vmrun.exe -T ws start ..." as Scheduled Task?

Jump to solution

Hi,

I've been using VMWare Server for a while and would really like replace it with VMWare Workstation since WS has some features that I want / need that Server does not, and I don't have a problem paying for good software. Basically I'm ready to purchase WS, but need to sort out one thing before I lay the money down.

Specifically, I need to be able to start VMs in the background during system startup in a fashion similar to Server - some will need to start before anyone logs on to the host. I am using VMWare Workstation 7 on Windows 7 Ultimate (x64), and one of the ways I have tried to make this work is to create a scheduled task. While I can successfully launch a VM with the vmrun.exe command in a variety of ways (from a runas cmd prompt for instance) the scheduled task method is giving me trouble. It will run fine as a scheduled task so long as the task option to "Run only when user is logged on" option is selected. However when I set it to "Run whether user is logged on or not" (what I actually need), and save it with credentials of the user that owns the VM, it always throws an error when I actually run the task.

I used a .bat file with the exact same command in it to redirect the output to a temp file, and the only error message thrown is simply "Error: Unknown error". The vmrun.exe command is as follows:

"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -T ws "start" "C:\Users\<USER>\Documents\Virtual Machines\<VM>\<VM>.vmx" "nogui"

Has this type of functionality been intentionally disabled? Any idea how I can work around this and get background VMs running at system startup with or without anyone logged on to the host? Suggestions for alternative methods to using a scheduled task are welcome.

Thanks and best regards,

Nate

0 Kudos
1 Solution

Accepted Solutions
TobiasKracht
Expert
Expert

I know one way, how to run VM as a service. It takes some time to implement:

Take tools Instsrv.exe and Srvany.exe from Windows 2003 Resource Kit tools.

Install and copy this two tools to system32 folder. Now in command promt run command Instsrv VM_SERVICE_NAME C:\windows\system32\srvany.exe. Then in registry go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VM_SERVICE_NAME, create new Parametrs and create new String Value. Call it Application and make value - "%Program Files%\VMware Workstation\VMware.exe" –x "%Path to your VM%\winxp.vmx".

Then run services.msc. Find there your service, make it run Automatic and in Log on tab choose Local System account option in Log on as menu, and check option Allow service to interact with desktop.

Try to run it. It can ask you to create new UUID, make it.

If you will add Hints.hideall="TRUE" you will see no pop up hints in VM.

StarWind Software R&D

http://www.starwindsoftware.com

StarWind Software R&D http://www.starwindsoftware.com

View solution in original post

0 Kudos
5 Replies
AWo
Immortal
Immortal

Specifically, I need to be able to start VMs in the background during system startup in a fashion similar to Server - some will need to start before anyone logs on to the host.

That is not possible as far as I know. Workstation needs an active desktop.

However, I'm not sure but I think I saw some threads here around explaining how to get a workaround.


AWo
VCP / VMware vEXPERT 2009

=Due to lack of employees, human beings work here. - Treat them carefully, they are rare.=

vExpert 2009/10/11 [:o]===[o:] [: ]o=o[ :] = Save forests! rent firewood! =
0 Kudos
AWo
Immortal
Immortal

Check this link for Workstation for Linux: http://communities.vmware.com/message/779175#779175

Check this link for Workstation for Windows: http://communities.vmware.com/message/1286635#1286635

As I said, Workstation is not designed to run without an active GUI.


AWo
VCP / VMware vEXPERT 2009

=Due to lack of employees, human beings work here. - Treat them carefully, they are rare.=

vExpert 2009/10/11 [:o]===[o:] [: ]o=o[ :] = Save forests! rent firewood! =
0 Kudos
TobiasKracht
Expert
Expert

I know one way, how to run VM as a service. It takes some time to implement:

Take tools Instsrv.exe and Srvany.exe from Windows 2003 Resource Kit tools.

Install and copy this two tools to system32 folder. Now in command promt run command Instsrv VM_SERVICE_NAME C:\windows\system32\srvany.exe. Then in registry go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VM_SERVICE_NAME, create new Parametrs and create new String Value. Call it Application and make value - "%Program Files%\VMware Workstation\VMware.exe" –x "%Path to your VM%\winxp.vmx".

Then run services.msc. Find there your service, make it run Automatic and in Log on tab choose Local System account option in Log on as menu, and check option Allow service to interact with desktop.

Try to run it. It can ask you to create new UUID, make it.

If you will add Hints.hideall="TRUE" you will see no pop up hints in VM.

StarWind Software R&D

http://www.starwindsoftware.com

StarWind Software R&D http://www.starwindsoftware.com

View solution in original post

0 Kudos
imacomputa
Contributor
Contributor

Thanks. I had seem similar posts indicating this same type of method and will give it a shot and report back.

Ultimately it just seems strange to me that this type of feature would be free in one VMWare product, and then be entirely missing from a another non-free VMWare product that otherwise has a much broader feature set...

0 Kudos
imacomputa
Contributor
Contributor

Looks like the srvany.exe method does work to get the VM started on boot, but with some caveats. I set it up to execute the vmrun.exe command, which is a little cleaner in that the VM doesn't persistently try to interact with the desktop. There is still the problem of the VM not being cleanly shut-down when the host is rebooted though, but thanks for the suggestion in any case.

0 Kudos