View Single Post
Old 04-12-2007   #2 (permalink)
Brandon Shell


 
 

Re: How to check service packs on remote computers.

$ser= get-Content c:\wmi\servers.txt

foreach($s in $ser)
{
$ServicePack = Get-WmiObject Win32_OperatingSystem -ComputerName $s
$ServicePack = $ServicePack.ServicePackMajorVersion
Write-Host "Server [$s] has SP [$ServicePack]"
}

--
Brandon Shell
---------------
Stop by my blog some time
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------

"Damon" <Damon@discussions.microsoft.com> wrote in message
news:94E0DBA1-DABC-4A67-BC78-2BDC36FAF548@microsoft.com...
> Hello,
> I am wanting to write a script that will take a list of server names and
> return the OS and service pack level.
> I have written
> $ser= get-Content c:\wmi\servers.txt
> Get-WmiObject win32_osrecoveryconfiguration -computername $ser |
> Format-Table __server, name
> This gives a list of the server and the OS but not the Service Pack level.
>
> Thanks for any help


My System SpecsSystem Spec