My usual programming language at work is Winbatch, since it’s geared towards automation and administration on the Windows platform. Today I took a fresh look at our Active Directory site definitions, which are a combination of the mapping of IP segments to site objects and the linking of the sites according to the network routing topology. I realized that if I could pump out the IP addresses of clients that reported they weren’t in an AD site, I could concatenate and compare them to our list of segment/building mappings and produce a list of IP segments (and possibly entire buildings) that need to be added to the site definitions. Based on all the string manipulation I’ve done with Python with ICYG, I figured as long as I could get both the event logs and the network information in flat text files I could breeze through them with a quick Python script to produce the list.

But first I had to export the AD domain controller event logs into a predictable text format. Enter MS’s recently revved Log Parser, which I had heard about, but hadn’t yet played with. After a trip to the Log Parser forums and four attempts to get the syntax right for what I wanted to do (export the event messages for all events with ID 5778), I had a CSV with the relevant client info created. I quickly scraped together the network info text files from some webpages and have everything set up to script against tomorrow morning.

And here I thought I’d never get a chance to use Python at work…