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.

Leave a Reply

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