Posts Tagged powershell

Powershell script to find OS and Servicepack version

Below powershell script is used to find OS and servicepack version of computers listed in c:\servers.txt.

Add the computer list in servers.txt.

open notepad and copy below script and save it as .ps1 extension.

Then execute the script from powershell window by providing full path to the script.

You should have proper rights to access the computer listed in the servers.txt file.

$c= get-content “C:\servers.txt”

foreach ($i in $c)

{
get-wmiobject win32_operatingsystem -computer $i | select ` csname,caption,servicepackmajorversion
}

,

2 Comments