Find Service Pack Information


The one constant about Windows operating systems is that there is always an update. Major updates are delivered as service packs. In fact, some people won’t even upgrade to a new operating system until the first service pack has been released. For the rest of us, and those of you who wait until SP1, you probably need a way to get a handle on what OS service packs you have installed. Assuming you don’t have some sort of system or enterprise management solution in place, you can gather this information yourself pretty easily.

Service pack information is stored in WMI as part of the Win32_OperatingSystem class. So to find out what service pack a particular computer is running, all you need to do is query WMI, and this doesn’t have to require complex scripting. When you query WMI, you will get an instance back of the Win32_OperatingSystem class. The properties we are most interested in are ServicePackMajorVersion and ServicePackMinorVersion, although I can’t think of an incremental OS service pack. The other useful property is CSDVersion, which displays service pack information in a “friendly” format. First, let me show you how to gather this information using the command line tool, WMIC.EXE.

This command queried the local computer for the 2 properties. Querying a few remote machines isn’t much more work.

I included a few other properties so I could see the computername and the operating system. One quick tip: when the computername has a dash, enclose it in quotes as I had to do. I don’t want to turn this into a WMIC lesson, but as I hope you can see, it is pretty easy to use and discover what service pack is installed.

Using Windows PowerShell is just as easy. The WMI class and property names are the same.

It doesn’t take much more effort to query hundreds of computers to find those that are not up to date. In fact, I wrote a PowerShell function called Test-ServicePack that you can download from the site. By default, this function will test a computer and see if its installed service pack is at least a specific version.

To see more information use the –Detail parameter.

The function tests if the service pack is at least a certain version. My domain controller is at SP 2, but checking for SP1 will return True.

To test for an exact version use the –Exact parameter.

To put this in a larger perspective, let’s say Microsoft releases a new service pack and you need a list of computers that will need it. Using a text file of your servers, it is as easy as this:

I also could have searched for version 1 only.


Finding what OS service packs you have installed isn’t difficult. Service pack information is not hidden away, you just need to know where to look.

Related Topics:

  • Windows Client OS

    Don't have a login but want to join the conversation? Sign up for a Petri Account