Scripting IT, one step at a time.

promptLearning to script as a SysAdmin is like learning to breathe properly for an athlete: Sure you can get along without it, but you’ll never be as good as someone that knows it (in case you were wondering, proper breathing is done in through the nose, out through the mouth, and from the diaphragm not the chest).

Learning to script will save you time and make your network run much smoother. You’ll wonder how you ever got along without it once you’ve experienced the benefits of being able to do 10 hours worth of work in 10 seconds through the power of a script.

The biggest hurdle that I encountered when learning to script was deciding which language to learn (I foolishly thought that I only needed to learn one, and then I’d be good). On the Windows side the house, the progression of scripting languages usually goes something like this:

First you learn batch scripting (called shell scripting in the *NIX world, and by some in the Windows world). Then when you start running into things you can’t do with shell scripting, you learn VBScript. With the recent introduction of PowerShell from Microsoft you can now progress to that as well when you find the things you can’t do with VBScript (which will likely take a while, as VBScript is pretty robust).

If I could give a SysAdmin just starting out in scripting only one piece of advice, it would be to forget that progression. It takes too long (took me about 4 years to go from Shell Scripting to PowerShell). Start with PowerShell.

You are going to find that there is a bit of a steep learning curve for PowerShell if you have never done any scripting but the payoff, I promise you, is well worth the headache. Don’t get me wrong, VBScript has been the scripting language of choice for the Windows SysAdmin since the introduction of WSH (Windows Script Host) with Windows 2000, and there are several distinct benefits of learning VBScript:

  • There are thousands of VBScripts readily available on the internet.
  • Learning to work with WMI and ADSI in VBScript will teach you a lot about both.
  • Pretty much anything you will want to do, someone has already done, and you can find their work via google (LAOAE applies here).

The reason I suggest that you go straight for PowerShell is the sheer power and flexibility that it offers. Unlike VBScript or shell scripting, PowerShell sees everything as an object, and as such gives you access to all of the DotNET Classes, Methods, and Properties for that object. This is very powerful when it comes to manipulating things with a script.

Another great reason to start off with PowerShell is that it was designed from the start to have built in security. By default PowerShell will not run scripts at all. Whereas the WSH (what runs VBScript) has no such compunctions, and will run ANY script right out of the gate (anybody remember the “I love you” virus?). In the past this has been an issue for SysAdmins, many going so far as to delete the WSH interpreter from their machines, so that NO scripts could be run.

On the Linux side the progression is from Shell Scripting, to Perl or Python. I would advise you to learn Shell Scripting first, as the BASH shell (the default on most Linux distros) is quite robust. Perl or Python (one is just as good as the other, though I prefer Python) will allow you to greatly expand what can be done with Shell Scripting. In addition, both Perl and Python can be run on Windows through the WSH interpreter.

At the end of the day making the commitment, and taking the time to learn a scripting language is more important than which language you choose. It will make your job easier, and make you feel like a Rock Star when you can use scripting to provide solutions to many of the difficulties you will face as a SysAdmin.

end

Advertisements

One Response to Scripting IT, one step at a time.

  1. BZ says:

    Thank you very much for this information; it was precisely what I was trying to determine: where to start.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: