VMware Communities
fiftyfour46
Contributor
Contributor

Auto-start VM after power outage or reboot Workstation 16 Pro

Before Shared VMs were removed in Workstation 16, Shared VMs were the best option to auto-power on VMs.

I understand folks can add `vmrun` batch scripts or powershell scripts but almost all of these options require the user to log in first.

The scenario I would like to avoid is:

  • I am cities away from my PC
  • A power outage or reboot occurs

On startup, I am not logged in and my startup scripts will not run. I can create a Scheduled Task that runs on power on (not login), however, when I finally gain access to my physical PC and log in, the Workstation client cannot control or access the VMs (running in background with `nogui`).

I have tried to run the Scheduled Task with "runAs: my account", but Workstation STILL cannot control unless I kill the processes and restart them.

Any thoughts?

11 Replies
scott28tt
VMware Employee
VMware Employee

Setup Windows to do an auto login?

https://support.microsoft.com/en-gb/help/324737/how-to-turn-on-automatic-logon-in-windows


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
tbthreatstop
Contributor
Contributor

What I want to know is why they removed Shared VMs from Workstation. When you're running a lab/QA environment, that is something that is really needed..

The power loss use case is just one of many.

It's basically pushing users to have to use Hyper-V on Windows, or KVM/QEMU on Linux to do what used to work great in VMware.

Reply
0 Kudos
loungehostmaste
Enthusiast
Enthusiast

get a real operating system

[root@srv-rhsoft:~]$ cat /etc/systemd/system/guest-testserver.service

[Unit]

Description=VMware-Guest Testserver

PartOf=vmware-guest.target

Requisite=vmware.service

After=vmware-vmnet.service network-up.service

Wants=network-up.service

[Service]

Type=oneshot

RemainAfterExit=yes

Nice=19

IOSchedulingClass=idle

User=vmware

Group=vmware

ExecStart=/usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/testserver/config.vmx' nogui

ExecStartPost=/usr/bin/sleep 1

ExecReload=-/usr/bin/vmrun -T ws reset '/mnt/data/fileserver/vmware/testserver/config.vmx' nogui soft

ExecStop=-/usr/bin/vmrun -T ws stop '/mnt/data/fileserver/vmware/testserver/config.vmx' nogui soft

ExecStop=-/usr/bin/sleep 1

TimeoutSec=300

SuccessExitStatus=255

ProtectSystem=full

CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_PTRACE

IPAddressDeny=any

IPAddressAllow=localhost

InaccessiblePaths=-/boot

InaccessiblePaths=-/efi

[Install]

WantedBy=vmware-guest.target

tbthreatstop
Contributor
Contributor

Very funny. I have 3 18" racks of VMWare ESXi/Nexenta running Ubuntu mostly (some solaris) in my main datacenter; 2 in the office, and 1 at the DR site. I'm well aware of how to manage init scripts. Been working on variants of Unix since 1981.
The machine I'm trying to do this on is my home lab/dev, which runs Windows because Linux is useless for gaming or multimedia.

So, if you don't have a real answer to the question asked, save it for someone who cares.

tbthreatstop
Contributor
Contributor

BTW: If you're running Linux for a host, why bother with VMWare at all? QEMU gives you the ability to emulate multiple architectures. My home server runs it, and I can, and do develop for Android, ARM, etc. using it.

Reply
0 Kudos
loungehostmaste
Enthusiast
Enthusiast

because there are people working with vSphere at their workspace and don't like to cuddle guest with different golden masters

Reply
0 Kudos
rthinds
Contributor
Contributor

No doubt.

If you don't have a REAL answer to his question - [removed by moderator].  You avoided the question by providing a "workaround" that required significant rework.  That's not ANSWERING THE QUESTION.

Next time [removed by moderator]

Reply
0 Kudos
George742
Contributor
Contributor

The assistance begins with windows - not when I logon, so blackouts will not be an issue. I run the windows administration with my qualifications so there is no issue with "proprietorship" issues with the VM's. At the point when I login, the VMware symbol is sitting tight for me in the systra.

---------------------------------------------------------------------------------------------------------------------------------------------------

 

 

 

 

 

Reply
0 Kudos
wila
Immortal
Immortal

Hi,

There's been some talk by the product manager of VMware Workstation to see if they can provide this functionality again in the future, but using a different technique.

See this post:
https://communities.vmware.com/t5/VMware-Workstation-Pro/Shared-VMs-are-back-in-Workstation-16-1/m-p...

That's not a guarantee, but it is at least an indication that VMware is considering bringing it back in some form.

Meanwhile.. I wrote a program that is catering for this scenario and it is available now.
You can find it here:

https://vimarun.com

(windows only)

hope this helps,
--
Wil

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

You could use 'nssm' to create a dummy service that runs a powershell script that uses vmrun

Reply
0 Kudos
techmed
Contributor
Contributor

Downloaded it and will try it!

Thank you