IT and Life Experiences
IT pros don't write code. IT pros don't develop applications, and we certainly don't want anything to do with mathematical algorithms and binary search trees. We leave that to the dev geeks with CompSci PhDs and cases of Mountain Dew under their desk. Okay, maybe that's a gross generalization and completely unfair to IT pros (not to dev geeks, though—you know who you are). But let's face it, there are those who work in infrastructure (welcome to TechNet!) and those who work in appdev (don't complain, you've had MSDN® for years), and never the twain shall meet. Except code can make your life easier. Scary as it may be, if IT pros are willing to open their hearts and minds a little to the idea of squeaking out a few miniscule lines of code, they'll have more free time, and what could be more important than that?
I'm not asking you to dig into header files or author COM objects or anything like that. We do, after all, have to remain loyal to our infrastructure core. But a few lines of plain-text batch or VBScript can go a long way towards finding some of that free time. For example, imagine your boss tasked you with creating, oh I don't know, 5,000 test accounts in Active Directory® in order to do some performance and application testing for an upcoming project. Definitely not a process you want to do manually, right? That's a few lines of VBScript. A few variables, a few loops, and you're finished. Want to create virtual machines instead of Active Directory accounts? Remember, each machine needs a virtual hard drive to go with it, as well as a network connection, memory settings, and user permissions. That's a grand total of 13 lines of code, and most of it is just defining the names of the machines.
Maybe you need to monitor Exchange queues or security logs. Or maybe you just need to rename a bunch of files, or get a list of disabled devices on your computer, or check the free space available on every computer in your organization. These tasks are a drop in the bucket when it comes to examples of things you can do with very simple scripts.
Personally, I'm a desktop deployment guy. Most of my time is spent helping companies deploy the very latest and greatest operating systems, applications, and updates (namely Windows® XP Service Pack 2, and Office 2003). I've done this work for a lot of companies, and not a single one of them was the same. Every organization likes their desktop to look and behave just a little bit differently. One company may want My Computer on the desktop while another may not. One company may want to show hidden files and another may not. And, of course, every company wants to use their custom wallpaper, and some of them may even want to prevent the end user from changing that wallpaper to a picture of their kid (or their car).
Almost anything you want to do to your desktop can be automated in a pretty simple script. For most desktop builds, I generally will create two files—an OSConfig.cmd and an OSConfig.vbs. The CMD file primarily includes reg.exe commands (the Console Registry Tool for Windows which allows command-line arguments to modify the registry). This is used to make simple modifications to the registry in order to customize the environment. OSConfig.vbs may make some of the more complicated changes, where Windows Management Instrumentation (WMI) may be involved (as the changes may be hardware-specific).
To learn more, go to The Script Center
. Under the esteemed supervision of The Scripting Guys, you will find everything you need to get started. I highly recommend taking a look at the sample scripts repository first. There is a huge collection of scripts there that will help you perform a wide variety of tasks, including all of those I've mentioned already. Of course, there is also the "Hey! Scripting Guy!" advice column, real-life stories in "Tales from the Script," and a whole lot more.
Your next stop should be the Microsoft Windows Scripting Self-Paced Learning Guide
. The Learning Guide will walk you through the necessities of scripting, including VBScript, Windows Script Host, Windows Management Instrumentation, and Active Directory Service Interfaces (the Trinity+1 of scripting).
Now please keep in mind that scripting alone is not generally a replacement for enterprise-scale products when it comes to monitoring and administration. But I guarantee there is a task in your day-to-day life that you can make easier with a script. Knowing that, I hope you'll consider taking that first step towards letting a little bit of scripting into your IT life.
Joshua Hoffman has been a desktop and infrastructure consultant with Microsoft Consulting Services for the past four years. A graduate of Rensselaer Polytechnic Institute, he currently operates out of the Microsoft office in Malvern, PA.
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited