The 2011 Scripting Games Beginner Event 6: Use PowerShell to Find Windows Update Errors

2011 Scripting Games badge

Summary: Beginner Event 6 of 2011 Scripting Games uses Windows PowerShell to find Windows Update errors.

About this event

Division

Beginner

Date of Event

4/11/2011 12:01 AM

Due Date

4/18/2011 12:01 AM

Event scenario

On your home computer, you notice that you have not been receiving Windows Update notifications. You are running Windows 7, and you configured Windows Update to download and install updates automatically, but you have not seen the update icon for a long time. After doing a little research on the Microsoft TechNet site, you discover that there is a WindowsUpdate.log file in the %systemroot%\Windows folder (on my computer that path is C:\Windows\WindowsUpdate.log). You decide to use Windows PowerShell to parse the WindowsUpdate.log file and look for fatal errors. You hope that discovery of fatal errors and subsequent recourse to the Knowledge Base articles on the Microsoft TechNet site will enable you to fix Windows Update on your computer, and bring your machine back into security compliance. The following image illustrates an appropriate output for this scenario.

Image of command output

Design points

  • The solution to this scenario does not need to be extensive or overly complicated.
  • Your goal is to retrieve fatal errors from the Windows Update log file, not to write copious amounts of code.
  • Extra points are given for simplicity and for shortness of code.
  • Use complete cmdlet names and parameters in your submission (but you can add a comment with any aliases that you want to illustrate). Extra points granted for shortness and for terse syntax: therefore, you might want to add comments with alternate syntax.
  • Remember that your goal in the scenario is to parse a log file, not to write a huge script! You will not win extra design points for an overly long and complex solution.

2011 Scripting Games links

2011 Scripting Games: All Links on One Page

Submit your scripts on PoshCode

Support our Sponsors!

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.

Ed Wilson, Microsoft Scripting Guy