Using PowerShell to find your operating system (OS) and service pack (SP) level

Using PowerShell to find your OS and SP levels

Michael Otey

December 30, 2014

1 Min Read
Using PowerShell to find your operating system (OS) and service pack (SP) level

You can use PowerShell to quickly display your server’s OS and SP levels. The following example shows how you how you can use the Get-WmiObject cmdlet to retrieve you server’s name, operating system, x86 architecture type and major service pack level.

# Get Operating System Info
$sServer = "myserver"
$sOS =Get-WmiObject -class Win32_OperatingSystem -computername $sServer

foreach($sProperty in $sOS)
{
   write-host $sProperty.Description
   write-host $sProperty.Caption
   write-host $sProperty.OSArchitecture
   write-host $sProperty.ServicePackMajorVersion
}

 

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like