19
votes

I am a fairly new Windows Systems Administrator. I have done some basic batch files and some other scripting. I would like to know what path I should take to become a better scripter. What language should I study and what are the best resources to learn from (web sites, books and the like).

8 Answers 8

4
votes

The language doesn't matter (much) - you're knocking on the door of asking to learn programming, and good programmers need to be fluent in more than one language. So, pick one and go with it. Suggestions

  • KiXtart is pretty good for simple-and-Windows.
  • PowerShell and VBscript are the standards on Windows.
  • Install Cygwin and learn bash.
  • Try Perl.
  • BAT has it's place, but it's a terrible language (if that) with a lot of weird (although sometimes useful) quirks.

How to get good? Pick a project that needs doing, and do it. Are you spending a lot of time doing any manual, repeatable process? Script it. Script it in pieces, make the pieces bigger or string them together, until the whole thing is scripted.

Take a college class for Intro to Programming, or intro-or-intermediate Unix, that should have items in the course description like 'ksh' or 'bash' or 'shell'.

5
  • If he is going to learn bash, I'd say go with a "real" scripting language.. :)
    – Earlz
    Mar 3, 2010 at 23:23
  • Yes, definitely give Perl a try. If it can't be done in Perl it probably can't be done at all. Mar 3, 2010 at 23:50
  • 2
    I wouldn't reccomend that a new windows admin use cygwin, use the copy of bash available for windows if you really must play with it. I'd start with the standards mentioned- vbscript and powershell, on windows everything else is an also ran (with the possible exception of batch files). College...you can go to college to learn klingon- it might be as useful as a college scripting course. If you can find it an old school modular programming course would be helpful. Microsoft also has some MOC courses that have similar content.
    – Jim B
    Mar 4, 2010 at 2:20
  • @Jim B - we'll have to agree to disagree about the utility of college. We may well have had different experiences. Does Microsoft have MOC courses on scripting, do you have any references?
    – mfinni
    Mar 4, 2010 at 4:59
  • 1
    I'll certainly agree to disagree- after all YMMV, my experience is based on both sending and interviewing folks that went to such courses. THe beginning microsoft courses are: MOC-2433 Microsoft Visual Basic Scripting Edition and Microsoft Windows Script Host Essentials After that take MOC-6434 Automating Windows Server 2008 Administration with Microsoft Windows PowerShell Training IN addition I should alaso mention that there are hands on labs avaialable for powershell- for vbscript you can use the same lab environments (althought it's not guided- it does give you a working lab)
    – Jim B
    Mar 4, 2010 at 14:00
12
votes

If you have seen much of what Microsoft is speaking of these days the choice of language is self-evident: PowerShell.

The "How do I become..." part of the question is a bit harder to answer. Without delving into the esoteric waters of information assimilation theory, you still need to figure out how you learn the best. My suggestion:

  1. Pick a task
  2. Script the task
  3. Figure out why the script doesn't work
  4. Fix the script
  5. Repeat steps 3 and 4 about a dozen times
  6. Gloat about your successes to your SysAdmin colleagues (that would be us)
  7. Repeat
3
votes

I started by finding/download scripts that did something and then read through them to see how things were done. The Scripting Guy is invaluable for windows. I would also sift through the Scripting Guide on technet. it has tons of articles on writing scripts, documenting, a bazillion examples of how to do things on windows (config printers, list all accounts in AD etc.) how to write to the system log etc.

2
votes

Depends on what you need to script for. I disagree with some of the assertions put forth by previous posters.

Batch is AWESOME. It's simple and MOST scripts I've had a need to write can be done with shorter code than most other scripting languages. It also has an advantage in that, with a few differences, it can be used on virtually every Microsoft operating system. It's also great because you can use just about any command line utility in your scripts so while the built in functions CAN be somewhat limiting at times, odds are, someone has a command line tool to do what you need and if you know batch scripting, you can incorporate it easily, giving you REALLY powerful stuff.

PowerShell is POWERFUL. But it's still fairly new. And while it's potentially VERY useful, it's newness means it's not necessarily something you can walk in and start using at any given client/situation.

VBScript is great and has many great features. It also adds to your skillset because VB script is similar to ASP which is similar to VBA which is similar to VB6, so in the end, if you know one of those languages, you can quickly figure out the others (in most cases).

Other scripting languages such as Perl, KiXtart, and so on have their places, but usually require additional tools/files installed. I'm a big fan of learning to do things with what comes STANDARD with the OS, so you don't get yourself stuck saying "I don't know how to do this" when you need to do something but installing something isn't an option.

As for resources, several have been mentioned and I can't complain about any of them... but I'm surprised and even disappointed two sites hasn't been mentioned - for general scripting tutorials and overviews, see www.robvanderwoude.com and for a comprehensive command line reference (especially for batch, but also for PowerShell and a few other useful things), see www.ss64.com

1
  • +1 in general but especially for "I'm a big fan of learning to do things with what comes STANDARD with the OS, so you don't get yourself stuck saying "I don't know how to do this" when you need to do something but installing something isn't an option." Mar 4, 2010 at 10:27
1
vote

I would start with a mixture of VBScript and PowerShell, both of which can be learned from "The Scripting Guys."

I'd recommend the following resources:

http://blogs.technet.com/heyscriptingguy/ http://technet.microsoft.com/en-us/scriptcenter/default.aspx

1
vote

PowerShell should be a prerequisite nowadays as a Windows SysAdmin. Make sure you get good practice with it.

Use it primarily with Exchange and Active Directory. After that you wont be just better at scripting, but you will also have significantly better skills to work with Exchange and Active Directory.

This will make you a better Windows SysAdmin and more valuable as an employee.

0
votes

Any scripting language, since you use Windows, I'd say Powershell is at least relevant.

Then, there are all of the other scripting languages which you can take your pick of such as Perl, Ruby, Python, and many others..

0
votes

AutoIt is the easiest, fastest way to learn scripting IMO comes with it's own CLI and has a really easy to use function reference that can handle ANYTHING you need to do in windows programatically.

www.autoitscript.com

2
  • That's a massive overstatement! Programatically you can do a LOT more than can be achieved through any kind of scripting. Mar 4, 2010 at 2:49
  • By programatically I simply meant anything you need to automate in windows (automate = programatically) Sorry for the confusion! Mar 4, 2010 at 17:50

Not the answer you're looking for? Browse other questions tagged .