If I use this, everything gets "Server1++" nothing ever gets anywhere. :-)
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Timo Ed Sent: Wednesday, May 24, 2006 4:22 PM To: [email protected] Subject: Re: [ActiveDir] OT help with VBS/WMI Script '========================================= For Each strComputer In serverList Set colSettings = "" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") If err then WScript.Echo strComputer + "++" else Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each OS In colSettings' WScript.Echo strComputer + "+" + OS.Caption + "+" + OS.Version Next end if Next '========================================= Rgds, Tim On 5/25/06, Hutchins, Mike <[EMAIL PROTECTED]> wrote: > So I am trying to get some information from a gigantic list of machines. > Problem is that if the machine isn't up, the script retains the > previous values. Example > > server1+Microsoft(R) Windows(R) Server 2003, Enterprise > server1+Edition+5.2.3790 > server2+Microsoft(R) Windows(R) Server 2003, Enterprise > server2+Edition+5.2.3790 > > In this example Server1 is Accurate (the "+" is a delimiter) > Server2 is not online so the script retained the OS.Caption and > OS.Version part. I would rather it be blank like; > > server2++ > > Here is the script part that this lies in. Any suggestions greatly > appreciated. > > For Each strComputer In serverList > Set colSettings = "" > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & > "\root\cimv2") > Set colSettings = objWMIService.ExecQuery _ > ("Select * from Win32_OperatingSystem") > For Each OS In colSettings > WScript.Echo strComputer + "+" + OS.Caption + "+" + OS.Version > Next > Next List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.activedir.org/ml/threads.aspx
