VMware Workstation

Discussion in 'Virtualization' started by Dromadus, Nov 17, 2017.

  1. Dromadus

    Dromadus MDL Novice

    Oct 7, 2016
    Start and stop VMware Workstation services on your laptop, do You stop them or not ?
    Do You use any script to them ?

  2. Leif Targo

    Leif Targo MDL Junior Member

    Oct 26, 2009
    #2 Leif Targo, Nov 23, 2017
    Last edited by a moderator: Nov 24, 2017
    sample batch vmstart.bat, works on german Windows 7, more than eight years old....
    @echo off
    rem ---------------------------------------------------------------------------------------------------
    rem -  stop services but prove before if VMs are running
    rem ---------------------------------------------------------------------------------------------------
    rem -  copy this batch and Microsofts devcon.exe  in the same folder
    rem -
    rem -  start batch as Admin: vmstart.cmd ":\MyPath\myVM.vmx"
    rem -  or make link to vmstart.cmd and define target  "C:\VM\Win7\Win7.vmx" 
    rem -  run "minimised" in this link
    rem ---------------------------------------------------------------------------------------------------
    rem ++++++++ define service ++++++++++++++++++++++
    set dienste=VMnetDHCP "VMware NAT Service" VMAuthdService
    rem  VMwareHostd VMUSBArbService
    rem ++++++++ define network connection +++++++++++++
    set "Verb=ROOT\VMWARE\0000 ROOT\VMWARE\0001"
    rem ++++++++ VMware process name +++++++++++++++
    set vm=vmware.exe
    rem define path to the devcon.exe util
    set _devcon="%~dp0devcon.exe"
    rem check if network connection are active and in use
    for %%a in (%Verb%) do (for /f %%i in ('call %_devcon% status @%%a^|find /I /C "running"') do if %%i==0 %_devcon% enable @%%a)
    for %%a in (%dienste%) do net start %%a
    start /WAIT "" %1
    rem check if the are more VMs are running if yes show error and do nothing
    for /f %%i in ('tasklist^| find /I /C "%vm%"') do if %%i NEQ 0 goto ende
    rem stop services and remove network connections
    for %%a in (%dienste%) do net stop %%a
    for %%a in (%Verb%) do %_devcon% disable @%%a
    rem remove all variables if you like
    set _devcon=
    set dienste=
    set Verb=
    set vm=