Script Tips

Service Pack Check-Up

Command-line script for checking out service pack deployments.

You don't need a programming background to get into scripts. Honest! Take this week's script, SPInventory.wsf, a complete administrative tool that happens to be written in VBScript. It's packaged in the Windows Script Host's .wsf file format, which is XML-based and which gives a script the ability to be executed straight from the command-line, including cool command-line arguments (or switches). So, even if you hate scripting, you can still use this handy tool!

This particular tool is designed to list the current service pack version on one or more computers. Launch it using the /computer:computername to get the latest SP version from one computer; use /list:filename to get the latest SP versions from a list of computer names contained in filename. Or, even better, use /container:ouname to point the script at an Active Directory organizational unit (OU) and get the latest SP version from every computer account contained in that OU. To download the script, click here. (If you have trouble downloading or viewing the script, contact Michael Domingo at mdomingo@101com.com.)

Normally, the script will output the latest SP info to the console, but you can change that by using the /output:filename argument. That'll dump the output to a comma-separated values (CSV) file named filename, giving you a convenient SP version report that contains each computer's name, operating system build number, and SP version number.

Want More Scripting?

For more scripting help, check out Don's work at http://www.scriptinganswers.com. Plus, don't forget "Mr. Script" columnist Chris Brooke over at http://redmondmag.com/columns/mcsescripting/.

And, let us know how you like Don's new column by e-mailing us at mdomingo@101com.com with "Scripting Answers column" on the subject line of your message and I'll send 3 lucky winners from all respondents a nifty MCPmag.com baseball cap. Contest ends December 16; winners will be announced in December 20th column.

This script is an excerpt from my upcoming book, Windows Administrator's Automation Toolkit (Microsoft Press), which will be released in 2005. Most of the scripts in that book will be in the WSF format, which has the advantage of making VBScripts usable as standalone command-line tools, requiring—if properly written—no scripting experience at all to deploy the script. For example, you'll notice a section of this script that looks like this:


<named helpstring="OU to pull computer names from" name="container" required="false" type="string"/>
<named helpstring="Run command against single specified computer" name="computer" required="false" type="string"/>
<named helpstring="Path and filename to write output to" name="output" required="false" type="string"/>

This section defines the command-line arguments that the script can accept: /list, /computer, /container, and /output. By having these defined within the WSF format's XML portion, you can run this script with the /? argument and get a complete help screen for using the tool—automatically. No script code is required to generate that screen; WSH will do it for you based on the XML configuration in the WSF file. I have bunches more WSF files, and some tutorials on how to create them yourself, on my site at ScriptingAnswers.com.

About the Author

Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.

comments powered by Disqus

SharePoint Watch

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.