mgroen1
Enthusiast
Enthusiast

auto start guest VM when host boots

I am running host Windows 10, with VMWare Workstation.

After the host is booted, I would like to have a guest OS started.

Is this possible to do? If so, how?

Thanks,

Mathijs

12 Replies
RDPetruska
Leadership
Leadership

The easiest way is to configure the VM as a Shared VM.  Note that doing this will disable some functionality - refer to the documentation.

0 Kudos
mgroen1
Enthusiast
Enthusiast

I don't have a dedicated server for Shared VM's. I run VM's on local machines.

Isn't there a way to start VM's by a command line? If so, create a .BAT file and auto start it with Windows?

0 Kudos
wila
Leadership
Leadership

Hi,

The "Shared VM' feature is a bit of a misnomer. I'd say that most people who use that feature run the VMs locally.

It should have been named "service VMs" or something more apt.

With a "Shared VM" you can start your VM when your host starts, even if you're not yet logged in.

If you're looking for a scriptable solution then check out:

vmrun start "/path/to/the/VM/Vmxfile.vmx"

Check out Vmrun - VI-Toolkit or type "vmrun" without the quotes and parameters to get a short help.

Alternatively you can also use the vmware command, but that involves the user interface and means you have to login first.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
mgroen1
Enthusiast
Enthusiast

Hi wila,

thanks for your reaction, it was usefull but I am still struggling with something else.

Now, I have created a bat file which runs the vmrun.exe command with the vmx file as parameter (as you suggested) - and that works.

However, I would like to have this window (this VM) minimized in the hosts taskbar.

Already tried changing the props of vmworkstation (start minimized), but that does not have effect on vmrun.

any idea?

0 Kudos
wila
Leadership
Leadership

You can try to run with the "nogui" option.

That means it isn't even in the taskbar. But you should still be able to go to the VM by opening VMware Workstation.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mgroen1
Enthusiast
Enthusiast

I already tried using nogui but everything I have tried gives me errors "incorrect parameter".

could you help me with the exact correct syntaxis?

what I have now (and it works), is:

vmrun start D:\VIRTUAL_MACHINES\vpn\2.vmx

this is in a .bat file which I run at startup.

cannot get any nogui option on this line working.


I am using Workstation on WIndows10

0 Kudos
wila
Leadership
Leadership

I don't use it myself and currently don't have access to VMware Workstation running on Windows..

Maybe this helps:

vmrun start exists with Error: The operation was canceled after upgrade to workstation 9

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mgroen1
Enthusiast
Enthusiast

well this is odd..

adding nogui to the of the line does not result in an error,

but actually I do not see any VM running. I mean with that no instance of Workstation running an VM in the Windows taskbar is visible.

this indeed looks like a nongui kind of thing but there totally no gui (maybe thats the option meant to be),

what I need is a minimized instance of the VM (running 2.vmx file in a minimized mode).

Seems like thats something different than the nogui option

0 Kudos
scott28tt
VMware Employee
VMware Employee

Moderator: Seeing as you're already getting help on this thread with the requirement to run minimised, the separate thread you created has been archived.

0 Kudos
wila
Leadership
Leadership

Hi,

Yes it is something different.

Running as minimized is a bit of an issue as there's no option available for it.

What you can probably do is to work around that with a tool like autoit and automate the keypresses needed to minimize the VM after it has started via vmrun.

Unfortunately I have no experience with autoit, just know that it is used for this type of thing.

eg. something like this:

https://beamtic.com/autoit-send

and the doc is here:

Function Send

and

Function ControlSend

Good luck!

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
mgroen1
Enthusiast
Enthusiast

Hi,

thanks for the tip!

I created a simple script with Autohotkey (similar tool as autoit), placed the script in Windows startup folder, and the result is exactly what I needed.

When my hosts boots, a new VM is started in minimized window.

If desired I can send the autohotkey script that I created.

Thanks again,

Mathijs

--

edit: added AHK script

wila
Leadership
Leadership

Hello Mathijs,

Yes please, I would appreciate it if you attach the AHK script here, I'm sure it will help others.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos