VMware Communities
Aligator123
Contributor
Contributor

Local Background(Service) VM Shutdown

Hi @All,

i have an Local VM that is installed as a Service.

So the VM starts with Windows and is alttime available.

Now i want to make a Script or something with wich i can shutdown the VM with one click.

I looked for VM PowerCLI but here, i think, i need a server (ESXi) and that doesnt work with a Local VM.

And vmware.exe -q PathToVM.vmx doesnt work  with a Background Machine, also i dont know if this is a clean shutdown

Ideas how it is possible ?

Best Regards

Thomas

Ps. Sry for bad English :grinning_face_with_big_eyes:

Version: Workstation 12 PRO 12.5.6

Reply
0 Kudos
11 Replies
continuum
Immortal
Immortal

Instead of vmware.exe try to create a script with

vmrun.exe stop <path-to-vmx>


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
Aligator123
Contributor
Contributor

Hey,

thanks for your answer.

That dont Work:

Error: The virtual machine is not powered on: C:\VM\MyVM.vmx

Tried with a VM that runs in foreground, that works but not when the VM run in the Background....

Reply
0 Kudos
Aligator123
Contributor
Contributor

Edit:

By the Way. After this manual i installed the VM as Service:

http://www.vmaschinen.de/newsletter/vm_als_dienst.pdf

Reply
0 Kudos
continuum
Immortal
Immortal

Deine Anleitung ist uralt.
Welche WS-version hast du ?
Die aktuellen Versionen haben ein feature namens shared VMs. Damit könntest du deine VM auch automatisch starten.
Wenn du deine VM die als Dienst läuft stoppen willst müsstest du auch mit demselben Account ein cmd ausführen.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
Aligator123
Contributor
Contributor

Stimmt die ist alt :grinning_face_with_big_eyes:

Meine Workstation ist die Version 12.5.6

Wie würde das ganze den via Shared VM's funktionieren ??

Reply
0 Kudos
continuum
Immortal
Immortal

Menü > VM > Manage > Share
Probier mal die VM in eine shared VM umzuwandeln. (Keine Sorge - das lässt sich probemlos rückgängig machen)
Dann sehen wir weiter


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
Aligator123
Contributor
Contributor

Hey,

die Option kannte ich gar nicht :smileyblush:

Damit funktioniert das starten der VM mit dem Host auf jeden Fall problemlos.

Gibt es denn auch noch einen Weg die VM automatisch "sauber" herunterzufahren wenn der Host runterfährt ?

Host = Win10 Pro

VM = WinServer2016

Gruß

Thomas

Reply
0 Kudos
continuum
Immortal
Immortal

Glaubt man der Propaganda so sollte das "eigentlich" funktionieren.
Meiner Erfahrung nach werden die VMs aber jedesmal hart abgeschaltet - deswegen sollten man sich keinesfalls darauf verlassen.
Ich würde dir dringend empfehlen dir hier für eine Lösung per "vmrun stop" aus zu tüfteln.
Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
wila
Immortal
Immortal

Hi,

PMJI, while I can read German without much issues, I'll save you the trouble of me butchering your language and write in English instead.

As Ulli said, it was supposed to work, then it got confirmed that it works - except - for shared machines... umm.. right..

Now in the next Workstation this is claimed to be a new feature. OK.. well.. call me not convinced yet.

Anyways.. please have a look at the following post, the author of it has researched this particular topic and found ways to have the VM shut down properly.

VMWare Workstation 12.5 Auto Suspend of Guests when Windows Host Shuts Down

Note: I haven't tried this myself as my "always on VMs" run on vSphere, but it looks quite convincing.

--

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
Aligator123
Contributor
Contributor

Hey,

im surprised...

First the .bat File doesnt work with Shared-VM's.

But in my Tests i found out that my Shared VM automatically shutdown when i restart my PC.

Here you see the Eventlog without Task-Sheduler, any Scripts or something. Just restart the Host:

Information: "Das Betriebssystem wird zur Systemzeit ‎2017‎-‎09‎-‎20T05:57:52.641084100Z heruntergefahren."

I got no crtiical Log.

You guys think that it works too when Windows automatically restarts after installing updates ?

Reply
0 Kudos
Aligator123
Contributor
Contributor

continuum​,

ich hätte da mal noch eine Frage....

Folgendes Szenario:

Ich muss des öfteren mal neue Rechner installieren, dazu habe ich eine Referenz-Windows10-VM.

Wenn ich dann also ein neues W10 installieren muss, nehme ich einfach die Festplatte stecke sie in meine Dockingstation am PC und kopiere da den Inhalt der VM drauf.

Danach habe ich Plug-and-Play und alles ist fertig.


Jetzt würde ich die VM gerne automatisch aktuell halten. Heißt:

1) Der Host ist immer an. Hier sollte die VM einmal die Woche (Freitags) automatisch via Aufgabenplanung hochgefahren werden.

2) Die VM installiert sich alle Windows-Updates

3) Die VM wird Sonntags wieder herruntergefahren.

Die 2 bekomme ich noch selber hin.

Meine Probleme sehe ich hier:

1) Der Host ist gesperrt

2) Damit ich den Punkt 2 oben umsetzen kann, muss die VM sich mit einem Benutzer anmelden (Allerdings nicht im Gast-Windows eingestellt, sonst muss ich das immer abschalten wenn ich einen Rechner ausliefere)

3) Der Host ist natürlich Sonntags immer noch gesperrt.

4) Mit VMrun habe ich schon etwas rumgespielt, bekomme es aber nicht hin die -t ws-shared Befehle zu nutzen da ich mich immer an einem Server anmelden soll. Aber die VM liegt ja lokal....

Benötige ich für das vorhaben die VM überhaupt als SharedVM ? Dachte eventuell wegen des einloggens des Users.

Hoffe Du kannst mir da etwas helfen.

Gruß

Thomas

Reply
0 Kudos