Hotfixes and service packs

We can use PowerShell to figure out the operating system the server is running on and on which service pack. The Win32_OperatingSystem WMI class contains the OS service pack information. The following script performs this query:

#current server name
$servername = "ROGUE"

Get-WmiObject -Class Win32_OperatingSystem `
              -ComputerName $servername |
Select-Object CSName, Caption,
       ServicePackMajorVersion, 
       ServicePackMinorVersion |
Format-List

Your result should include the computer name and the service pack information. If you get a zero (0) value, it means no service packs have been applied to the system yet.

Hotfixes and service packs

In addition to ...

Get PowerShell for SQL Server Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.