2012 Scripting Games Advanced Event 3: Create a Log that Updates

 2012 Scripting Games badge

Summary: Advanced Event 3 of the 2012 Scripting Games challenges you to create a log file that appends each time a person logs on to the network.


About this event



Date of Event

4/4/2012 12:01 AM

Due Date

4/11/2012 12:01 AM


Event scenario

You are “the scripting guy” at your small single location business. As a matter of fact, you are also “the Exchange Server guy,” “The AD guy,” and “The WSUS guy.” In short, you seem to do it all. The IT department consists of the CIO, you, and a Help Desk person. All servers are running Windows Server 2008 R2, and all workstations (except the IT department) are running Windows 7 Enterprise edition. About half of the workstations are running a 32-bit operating system, and the other half are running a 64-bit operating system. All of the workstations are running the 32-bit version of Microsoft Office 2010. The IT department staff (you, the Help Desk person, and the CIO) are running a beta version of Windows 8 on your client computers with a beta version of Office 2012.

Your boss, (aka, the CIO) has decided that she would like the Help Desk person to have a log that updates each time a person logs on to the network. The log, named logonstatus.txt should be stored in a folder off the root named logonlog. This file should append (the latest entries will be at the bottom of the log file) each time the user logs on. Therefore, if a user logs on to the computer 12 times in one day, there will be 12 entries in the log. Here is a list of things the CIO has mandated MUST be in the log file:

  1. The user name in domainname/username format, for example: Microsoft/EdWilson
  2. The computer name in hostname.domainname format, for example: Mred.Microsoft.Com
  3. Operating system version
  4. Service Pack level
  5. All mapped drives and path to mapped resources
  6. The default printer
  7. The last reboot of the computer
  8. The type of boot up (for example, safemode or normal)

The image shown here illustrates an acceptable output for the file.

Image of command output

Design points

  • For the purpose of this exercise, we are looking for a specific file name in a specific location.
  • The file must append. Do not overwrite the file on each log on or you will lose a point. The history aspect of the file is important to the scenario.
  • You must include all eight pieces of information in the file. If you miss information, you will lose points.
  • Neatness counts. The information presented must be accurate and easy to read by humans. Therefore, outputting as a .csv, .tsv, or .xml file will not gain extra points. In fact, because they are not very humanly readable, you will lose points for such output. The idea here is that a Help Desk person will open the file and read it.

2012 Scripting Games links

2012 Scripting Games: All Links on One Page

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