Enabling and Disabling Windows Services automagically.

I got tired of enabling/disabling VMware services every time, so I wrote a little PowerShell script for this:

Change services mode to manual initialization and start them:

$services="vmauthd*","VMnetDHCP*","vmware*","VMUSBArbService*"
foreach ($service in $services) {
    gwmi win32_service|?{$_.name -like $service}|%{$_.changestartmode("Manual")}
    gwmi win32_service|?{$_.name -like $service}|%{$_.startservice()}
}

Stop services and disable their initialization settings:

$services="vmauthd*","VMnetDHCP*","vmware*","VMUSBArbService*"
foreach ($service in $services) {
    gwmi win32_service|?{$_.name -like $service}|%{$_.stopservice()}
    gwmi win32_service|?{$_.name -like $service}|%{$_.changestartmode("Disabled")}
}

Attention: You need to run the scripts in administrator mode.

 

EDIT: Lately I couldn’t  launch VMWARE on Windows 10 anymore, due to Device Guard being active. What I do to disable it (temporarily):

1) Open Local Group Policy Editor and change:
   1.1) Computer configuration -> Administrative Templates -> System -> Device Guard -> Turn On Virtualization Base Security (on the right side) from "Not Configured" to Disabled.
2) Open Powershell (as admin) and run:
   2.1) bcdedit /set hypervisorlaunchtype off

 

Leave a Reply

Your email address will not be published. Required fields are marked *