Now Available:

line

Realtime Communities

line

Newsletter

Email Address:

line

RSS

  • XML
  • iTUNES
line

Ask the Expert

Have a question for our resident expert? .

« Advanced Patch Management Week! What's Cool with WSUS 3.0 RC and Scripting WSUS 2.0 | Main | Another Off-Cycle Microsoft Patch Coming -- This Time its DNS... »

Hacking WSUS #1 of 5 -- Created Installed Patches Report

This week is Advanced Patch Management week here at Realtime Windows Server. Every day this week we're going to focus on ways to leverage the COM and VBScript exposure in WSUS to extend its capabilities into areas that most Windows administrators wish were natively in the GUI.

If you listen to this week's podcast, you'll hear some of the upcoming features in WSUS that we'll be getting in the new 3.0 version. But, until that version releases, I'm sure these five scripts are some that you wish you had now. In some cases, these scripts will provide functionality that will not appear in 3.0. According to Joseph Dadzie, WSUS program manager at Microsoft, the scripting exposure in 3.0 is a superset of all previous versions. So, what we expose here should function with no problems when you upgrade.

Our first script is an easy one. Ever wanted an easy way to pull a report into Excel that lists the installed patches on a list of machines? This script will do just that. You'll get an output file called Output.CSV with your answers.

For this script, you'll need to create a text file with a list of computer names -- one per line -- and reference that file when you run the script. An example: wsusDetectInstalled.vbs computers.txt.

Here's the code:

strComputerList = WScript.Arguments.Item(0)

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(strComputerList, 1, True)
Set objTextFile = fso.OpenTextFile("OUTPUT.csv", 2, True)
objTextFile.WriteLine("Computer Name,Update Title")

Do While f.AtEndOfLine <> True
 strComputer = f.ReadLine
 Set objSession = CreateObject("Microsoft.Update.Session", strComputer)
 Set objSearcher = objSession.CreateUpdateSearcher()
 intHistoryCount = objSearcher.GetTotalHistoryCount

 Set colHistory = objSearcher.QueryHistory(0, intHistoryCount)
 For Each objHistory in colHistory
  objTextFile.WriteLine(strComputer & "," & Replace(objHistory.Title, ",", ""))
 Next
Loop

WScript.Echo "Done!"

Note that with all the scripts we'll be seeing this week -- and, for that matter, any script posted here to the Community -- use them at your own risk.

TrackBack

TrackBack URL for this entry:
https://realtime-windowsserver.com/type/mt-tb.cgi/88

Most Active Posts

line

Library Resources

line
line

Recent Posts

  • Memorial Day! Take it Easy Today...
  • Microsoft SoftGrid Sequencing Best Practices
  • Holy timing, batman! Microsoft Press Releases Windows Server 2008 Book
  • CBT Nuggets "Introduction to VBScript" Series to be Released Soon
  • Free CBT Nuggets Citrix and SMS Videos
  • WSUS 3.0 Auto-Update Excludes SBS Servers
  • Sarbanes-Oxley Revision under Review -- This may be a Good Thing
  • WSUS 3.0 update posted to WSUS today
  • Citrix Access Suite 4.5 Video Demos Available
  • Arguably the Least Specific or the Most Necessary Terminal Server Hotfix Ever
line

Greg Shields' Bio:

Greg Shields is a Principal Consultant with 3t Systems in Denver, Colorado. With more than 10 years of experience in information technology, Greg has developed extensive experience in systems administration, engineering, and architecture specializing in Microsoft, Citrix, and VMware technologies. Greg is a Contributing Editor for both Redmond Magazine and Microsoft Certified Professional Magazine, authoring two regular columns along with numerous feature articles, webcasts, and white papers. He is known for his abilities to relate highly technical concepts with a drive towards fulfilling business needs. Greg is also a highly sought-after instructor and speaker, teaching system and network troubleshooting curriculum for TechMentor Events, a twice-annual IT conference, and producing computer-based training curriculum for CBT Nuggets on numerous topics. Greg is a triple Microsoft Certified Systems Engineer (MCSE) with security specialization and a Certified Citrix Enterprise Administrator (CCEA).