Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to "start" a virtual machine (it may be powered down or hibernating) via a scheduled task in Windows 7. I cannot figure the correct way to do this.

I tried scheduling the cmd task, which works if I run it manually.

cmd "x:\test1.vmcx"

None of the applications in the Virtual PC area of system32 seem to be working with arguments.

c:\windows\system32\vpc.exe "x:\test1.vmcx"
c:\windows\system32\vmwindow.exe "test1"
c:\windows\system32\vmwindow.exe "x:\test1.vmcx"

And I tried the VMSal command described here, without an application argument (I used my machine's 2nd param, not one listed in the command).

c:\Windows\System32\VMSal.exe "test1" "||2073a9cc"
share|improve this question

Make a batch file with this in it:

"C:\path\to\VMWindow.exe" -file "C:\full\path\to\file.vmcx"

Replace values accordingly, as I do not know where your Virtual PC installation is situated. Keep the quotes just in case, as any path with spaces in it will break your batch script (ie: Virtual PC).

Save this and run the .bat file from task scheduler.

share|improve this answer
    
There is no virtualpc.exe in Windows Virtual PC (for Windows 7). There is a vpc.exe (the process that shows in Task Manager when VPC is running). The Start Menu shortcut "Windows Virtual PC" goes to vmwindow.exe. And XP Mode style application shortcuts are vmsal.exe. – Anthony Mastrean Dec 14 '09 at 17:12
    
You'll want vmwindow – John T Dec 14 '09 at 17:34
    
I can execute the batch file from the command line, but it is not working from Scheduled Tasks even with highest privileges. – Anthony Mastrean Dec 14 '09 at 21:24

I managed to create a PowerShell script that would execute the *.vmcx file in the Explorer registered application.

& 'x:\test1.vmcx'

I then registered the PowerShell executable as my task "action" and the path to this script as an "argument".

<path-to-ps>\powershell.exe x:\start-test1.ps1
share|improve this answer
    
Using just the script as the task "program" opens in Notepad... even though it has a PowerShell icon. I don't want to mess with this behavior, so I use the PowerShell program and argument. – Anthony Mastrean Dec 14 '09 at 22:28
    
The command window closes after execution using the PS script! – Anthony Mastrean Dec 15 '09 at 16:30
up vote 0 down vote accepted

I managed to get a batch file to work. The batch file leans on Explorer.

x:\test1.vmcx

I just make it the "program" in the Scheduled Task action.

x:\start-test1.bat
share|improve this answer
    
I can't get the command window to disappear after execution... any thoughts? – Anthony Mastrean Dec 15 '09 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .