|
HELP: Script for checking sp level in Win 2000/2003 Servers
|
|
06-28-2010, 06:35 AM
Post: #1
|
|||
|
|||
|
HELP: Script for checking sp level in Win 2000/2003 Servers
Hi Script Guru,
I need a help for writing a script for finding the service pack installed on a windows 2000 / 2003 server. The condition is I have multiple servers say around 800 servers. Few have Service pack 1 and others have Service pack 2. I need to separate a list of servers which has Sp1 and Sp2. I don't want to login to each server for finding this information. I have a script for pinging multiple servers. Where I place the computer names in a text file and fetch the computer name in the script and separate the servers which ping in text file 1 and which do not ping in text file 2. ( I have posted this script in another thread under this section) Also I found your idea of using the below script for finding the sp level WScript.Echo strOSLongName, strSPLongName WScript.Echo "Version:", strOSVersion WScript.Echo "Build:", intBuild WScript.Echo "Service Pack Level:", intSPMajorVersion WScript.Echo "SP Version:", strSPVersion Its confusing for me in using the above script. Can you please post a script that fulfill my requirements? This might be useful for others too http://www.windowsscript.com/forums/imag.../smile.gif |
|||
|
06-29-2010, 12:31 AM
(This post was last modified: 06-29-2010 01:51 PM by Nilpo.)
Post: #2
|
|||
|
|||
|
RE: HELP: Script for checking sp level in Win 2000/2003 Servers
I recommend you take a look at WMI for this. It's actually pretty easy.
WMI's Win32_OperatingSystem class provides the CSDVersion property that returns a string indicating the current Service Pack level like "Service Pack 2". You can access it pretty easily like this: VBS Programming
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
06-29-2010, 12:33 PM
Post: #3
|
|||
|
|||
|
RE: HELP: Script for checking sp level in Win 2000/2003 Servers
When I run the above script I get the following error.
------------------------------------------------------- D:\>cscript 2.vbs Microsoft ® Windows Script Host Version 5.6 Copyright © Microsoft Corporation 1996-2001. All rights reserved. D:\2.vbs(5, 1) Microsoft VBScript compilation error: Expected ')' --------------------------------------------------------- Is there a way to do the following, I have a server A - Which is like a Jump server - I mean I can connect server 1 -100 from this server A. I need to run the script in Server A and get the information of service pack in Server 1 - 100. I'm looking something which can do above. |
|||
|
06-29-2010, 01:51 PM
Post: #4
|
|||
|
|||
|
RE: HELP: Script for checking sp level in Win 2000/2003 Servers
Sorry about that. The code is fixed.
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
06-29-2010, 06:24 PM
Post: #5
|
|||
|
|||
|
RE: HELP: Script for checking sp level in Win 2000/2003 Servers
Hi,
The above script which you gave just returned a null value. When I executed it, it shows me a message window saying 'null'. However, I figured out a way to pull out the sp level. Here it is, strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colSettings Wscript.Echo "OS Name: " & objOperatingSystem.Name Wscript.Echo "Service Pack: " & _ objOperatingSystem.ServicePackMajorVersion _ & "." & objOperatingSystem.ServicePackMinorVersion next The above one works perfect for me. But my question is how do I extract the result in excel or text file? Also how do I get the information of service pack for 100's of servers without logging into them? |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| Script for Pinging multiple servers | Hari Kumar | 1 | 760 |
06-29-2010 12:42 AM Last Post: Nilpo |
|
| Forum Permissions |
| You cannot post new threads. You cannot post replies. You cannot post attachments. |
| HTML is turned off. MyCode is turned on. Smilies are turned on. [img] is turned on. |


Search
Member List
Calendar
Help




