Why Aren't You Scripting?
GUI-based administration might linger for a while, but working from the console prompt is the wave of the future. And that means scripting.
- By Jeffery Hicks
The days of GUI-based Windows administration are numbered. There, I said it. Now what? Are you ready for what comes next? To be fair, I imagine there will be some form of GUI-based administration in the foreseeable future. Entry- and low-level IT professionals will be given simple tasks to perform as part of their jobs, and those tasks will most likely involve a GUI. However, more senior-level staff members will perform most of their work from a console prompt. If you're working from a console prompt, that also offers the possibility of scripting. Don't run away just yet.
Scripting doesn't have to be complicated. For example, take all the commands you'd run from a CMD shell and put them in a text file; save the file with a .BAT extension, and you've just created a batch file. Take a series of PowerShell commands; copy and paste them into a text file with a .PS1 extension, and you've just written a PowerShell script. Granted, more sophisticated scripts will require flow control, logic constructs and error handling, but you'll master those things with experience and practice.
Learn to Script!
Here are my top five reasons why you should start learning a scripting language:
1. Anything you can do once manually, you should be able to automate with a script. Nobody wants to run the same steps 100 times, but with a script you can "set it and forget it."
2. Scripting eliminates process errors because the steps have been standardized in your script. A script to create a new user account will create the account the same way each time it's executed. The script can also serve as documentation.
3. You can eliminate tedious tasks. Even if you have to run a few complicated commands once a week, put them in a script. Execute it, and you're done.
4. It's easier to delegate work with a scripted solution you can hand off to junior staffers. Scripting editors can be used to package the script into an .EXE file, as well as use alternate credentials if you require that level of sophistication.
5. Finally, in today's marketplace, who do you think your boss will want to keep around: the staffer who can automate bulk modifications of Active Directory that take place during non-production hours to limit impact on replication, or the staffer who can't? IT pros with scripting expertise have more to offer their employers.
Choosing a Language
I can guess the next question on your mind: "Which language should I learn?" I'm asked this question quite often. In a perfect world, I'd suggest learning VBScript and PowerShell, because both will play a role in your professional life for the next few years. Realistically, I'd say it depends on work and daily tasks.
Is most of your work end-user oriented? Are you responsible for log-on scripts and the like? Are you responsible for configuring desktops or tweaking deployments? If so, I'd suggest starting with VBScript. For one, VBScript is ubiquitous, and there's an enormous library of VBScript samples for you to repurpose or use as learning tools. The time spent learning VBScript won't be lost when you move to PowerShell, as you'll use the same logic constructs, such as IF statements. You'll also be able to continue to use COM objects in PowerShell, just as you did in VBScript. Actually, it's easier.
On the other hand, if the majority of your time is spent managing servers, networks or Windows products like Exchange, Windows PowerShell is the best choice. This is primarily because it's what Microsoft is moving toward for management -- so you might as well start learning it now. What you'll appreciate about PowerShell is that not only can you create powerful and flexible scripts or functions, you can easily manage your environment directly from the console without having to write a single script. Once PowerShell version 2.0 is released, I think you'll be amazed at how much you can accomplish with a few commands. Plus, scripting is as easy as copy and paste.
I'm sure you'll want scripting books, training, resources and tools. You'll find plenty of suggestions, and feel free to stop by the forums at ScriptingAnswers.com and ask what people recommend.
So, if you aren't scripting, why not? It's not hard if you start small and slowly. Of course, Mr. Roboto will be by your side, ready to lend a hand.
Jeffery Hicks is a Microsoft MVP in Windows PowerShell, Microsoft Certified Trainer and an IT veteran with over 20 years of experience, much of it spent as an IT consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He works today as an independent author, trainer and consultant. Jeff writes the popular Prof. PowerShell column for MPCMag.com and is a regular contributor to the Petri IT Knowledgebase and 4SysOps. If he isn't writing, then he's most likely recording training videos for companies like TrainSignal or hanging out in the forums at PowerShell.org. Jeff's latest books are Learn PowerShell 3 in a Month of Lunches, Learn PowerShell Toolmaking in a Month of Lunches and PowerShell in Depth: An Administrators Guide.
You can keep up with Jeff at his blog http://jdhitsolutions.com/blog, on Twitter at twitter.com/jeffhicks and on Google Plus (http:/gplus.to/JeffHicks)