Checking and Setting the Start Mode of a Windows Service with PowerShell

Working with Services in PowerShell is probably one of the first tasks you’ll undertake as a PowerShell newbie. Recently I needed to disable a few Windows services on a server and I’m a big believer in being able to get back to where you started so the first thing I set out to accomplish was to find out what the start mode was of the services I needed to change.

My demo machine doesn’t have those particular services I referenced so the BITS service will be used for the demonstration in this scenario:


By default only a few properties are displayed, but like most things in PowerShell, there’s more properties available than are returned by default. I’ll simply pipe the previous command to the Select-Object cmdlet, specify the -Properties parameter and use the wildcard character (asterisk) to return all properties and their values for the BITS service:


As you can see in the previous results, there’s still isn’t a StartMode parameter. You can certainly change the StartMode of a service from within PowerShell with the Set-Service cmdlet, so why can’t you check to see what the StartMode is from within PowerShell?

It can be done in WMI and PowerShell has cmdlets for accessing WMI. It’s not really PowerShell’s fault that it doesn’t natively display the StartMode property though. You see, PowerShell runs on the .Net Framework and the Get-Service cmdlet returns the same properties as the underlying .Net Framework class which that cmdlet uses:


The previous results should look familiar (they’re the same results as Get-Service).

We could use Get-CimInstance or Get-WMIObject to access WMI, specifically the Win32_Service class to see the StartMode property and its value for the BITS service:


As you can see in the previous command, the StartMode for the BITS service is Manual.

I’m now going to change the StartMode for the BITS service to Automatic:


No error, but did the previous command do anything? You can make the previous command return the service that was changed by adding the -PassThru parameter:


I’ll now double check to make sure the StartMode was indeed changed and this time I’ll use the Get-CimInstance cmdlet which was introduced in PowerShell version 3 and can also be used to access WMI:




  1. Graeme

    So, I think that you need to re-write this using a DSC module to disable all the services that you specifically require so that you don’t have to do it this way…


  2. Prince

    Thanks for the service start mode, its help me for my supervision project ;D


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: