Re: Script to determine Service Pack on numerous servers by BBB
BBB
Thu Mar 06 15:04:02 CST 2008
Thank you Pegasus. Works like a charm!
--
If you love the life you live, you will live a life of love...
"Pegasus (MVP)" wrote:
>
> "BBB" <BBB@discussions.microsoft.com> wrote in message
> news:DDD48758-E13D-4C8C-9F6E-63E5DA530EE4@microsoft.com...
> > Hello,
> >
> > I'm not a scripting guy so I need some assistance. I need to obtain the
> > service pack levels on numerous servers. Is there a script I can use that
> > could read a list of servers in a text file and output the answers to
> > either
> > a text file or CSV?
>
> You could use this script:
>
> PCList = "c:\PCs.txt"
> Tab = chr(9)
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> set objStream = objFSO.OpenTextFile(PCList, 1)
>
> while not objStream.AtEndOfStream
> PCName = trim(objStream.Readline)
> Set OSSet = GetObject("winmgmts://" & PCName _
> & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem")
>
> For Each OS In OSSet
> wscript.echo PCName & Tab & OS.Caption & Tab & OS.CSDVersion
> Next
> wend
> objStream.close
>
>
>