0

I'm trying to use Windows Task Scheduler to run a bat-file, which starts a specific Oracle VirtualBox VM. Now while the VM does in fact start, it does not appear in VBoxManage list runningvms when I do this from a command prompt afterwards. And yes, the scheduled task is set to use the same account as I am logged in as, which is "Administrator". The task does however have "Runwhether user is logged on or not", if that should matter.

I can't really understand what causes this, and hope I've missed something basic. I've even made the bat print out what the user and domain is when running the task and it clearly shows the same user as I am logged in as. I do access the machine that all of this is done on remotely, if that should matter (although also there the user login when remoting is the same as that of the scheduled task).

The bat is this:

C:
cd C:\Program Files\Oracle\VirtualBox\
VBoxManage startvm MyVM -type headless 1> C:\log\vbox_startup.log 2>&1

I'm also grasping at straws here, but I'm looking in the "History" tab of the scheduled task, and all the log events have "User: System", which is not the user I want to execute the task, but I guess this is the user that is making the log entry?

Also if I start the VirtualBox GUI it shows the VM as not running, while it is in fact running (but apparently under some different user?). I also checked the details under "Task Manager" and found that the VBoxHeadless.exe files are listed as running by user "Administrator", which should be correct. The bat seems to generate THREE VBoxHeadless.exe and ONE VBoxSVC.exe.

What can I have missed? How is this not working through task scheduler, but working directly in command prompt?

I'm not sure if this is relevant, but I've additionally tried to do a similar task for shutting it down, which generates this error when trying to shut down through task scheduler:

VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Shared)" at line 101 of file VBoxManageControlVM.cpp
  • C:\Program Files\Oracle\VirtualBox\ should be quoted as it contains a space ... – DavidPostill Dec 15 '16 at 12:49
  • @DavidPostill Thank you, but as the VM starts (it is accessible remotely) I do not believe this to be the problem. – TragedyStruck Dec 15 '16 at 12:54
  • @DavidPostill no need for cd, because it's a very special command, although quoting the path is still the recommended way – phuclv Dec 15 '16 at 14:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.