Stepping Up to Scripting

Admin wants to move up the experience ladder and learn scripting.

Bill: I'm a relatively experienced Windows and NT administrator who wants to get my skills to the next level by learning scripting. I know that there are a lot of scripting languages out there. I'd like some advice on which one to choose and how best to get started.
—Chuck

Chuck: You're making the right career choice, Chuck, because a thorough knowledge of scripting will enhance your career as an administrator more than just about any other single skill. You'll not only learn how to do your job more efficiently and effectively, you'll learn more about the fundamental operation of the operating system and network as you gain experience writing scripts.

The choice of a scripting language depends quite a bit on how portable you want your skills to be and how much help you expect to get in the way of example scripts and so forth. Opinions vary widely. Here's my take on the subject.

Get Help from Bill

Got a Windows or Exchange question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to Bill at mailto:boswell@101com.com; the best questions get answered in this column.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message but submit the requested information for verification purposes.)

If you are primarily a Windows administrator and you anticipate only working in a Windows environment for the next two to five years, then VBScript is probably your best choice. It has a wide range of capabilities, it's simple to learn and you'll have lots and lots of company to turn to for advice and pointers and sample scripts.

VBScript is not the best choice, though, in situations where you need to feed more than a few arguments into the script or you need to implement a complex flowpath. Also, the file-handling syntax in VBScript will make you want to curse in many languages, not just programming ones. If you start with VBScript, you can graduate to Visual Basic .NET to build handy little GUI-based utilities and to do Web interfaces, but once again, you're tied to a single platform family.

Javascript gives you quite a bit of power and flexibility in building Web-based tools. So does Perl. Both are devilish to learn but once you master them, you'll have a skill that can be used outside of Windows in the event that you want to expand your marketability.

Personally, I really like Python. It's simple to learn, completely intuitive, amazingly flexible and pretty darned fast. Python has only just started to claim mindshare in the Windows world, but look for it to start gaining lots of support as people discover it.

Bottom line? Learn VBScript for down-and-dirty Windows jobs and Python for cross-platform, enterprise-class work.

To learn VBScript, start with the Windows 2000 Scripting Guide from Microsoft Press. It was written by "The Scripting Guys" at Microsoft and is a truly indispensible resource. The presentation is conversational, the scripts really work, and the examples are clear and practical.

To learn Python, I'd start with Core Python Programming by Wesley Chun. The online documentation and tutorial is also terrific. A great free tutorial called "A Byte of Python" is available at http://www.python.g2swaroop.net.

You might also want to check out the online Safari library at http://safari.oreilly.com. For a few dollars a month, you can browse and search a whole bookshelf. I use this resource constantly.

Hope this helps.

About the Author

Contributing Editor Bill Boswell, MCSE, is the principal of Bill Boswell Consulting, Inc. He's the author of Inside Windows Server 2003 and Learning Exchange Server 2003 both from Addison Wesley. Bill is also Redmond magazine's "Windows Insider" columnist and a speaker at MCP Magazine's TechMentor Conferences.

comments powered by Disqus

Reader Comments:

Mon, Nov 21, 2005 Anonymous Anonymous

ad

Tue, Jul 6, 2004 Mike Ann Arbor

One thing nice about Python is that it is great for gluing together other scripts. If you have a few VBScripts that do a variety of tasks and want to batch them, you can use Python to do that.

Also, if you don't get too down and dirty in Windows, Python may be all you need. Python on Windows with Mark Hammond's win32all package has lots of hooks into COM, the registry and the Win32 API.

In addition to the great resources in print and on the web, the Python community is very helpful. In most cases, when I have a choice, I reach for Python.

And one other book that I've found helpful for Python on Windows is O'Reilly's Python Programming on Win 32 by Mark Hammond and Andy Robinson. It's not a very good introduction into the language, but if you've got some Python and some Windows programming under your belt, it fills in a few gaps rather nicely. At least that's what I found.

Thu, Jul 1, 2004 Sylvain Montreal

I totally agree with Bill for learning scripts to be a better network administrator. I use scripting a lot. One product that was not discussed in this article is Kixtart (www.kixtart.org). Kix is free, fast, has been there for a few years and works on any flavor of Windows (except some newer functions). It works great for login scripts. It is easier to learn than VBScript for simple functions. Lots of functions are also available from other users. I use both VBScript and Kixtart in a Windows environment. I'll take a look at Python as well.

Wed, Jun 30, 2004 Ron Kansas

VBScript is a VERY powerful language when used to manage Windows NT-2000-XP-2003 machines (the 9x machines - not so much).

VBScript using ADSI allows one to programatically change pretty much anything in Active Directory

VBScript using WMI allows one to programatically change pretty much anything on computers and servers (i.e. Registry settings, Service settings, Permissions, etc)

The book recommended in the article for VBScript is excellent and I highly recommend it as well.

IMHO, you are not an effective administrator unless you know how to script. I consider it to be one of the most important skills to have.

And learning scripting is a LOT cheaper and more effective than buying all those third-party AD and computer management solutions out there. IT Managers could save a LOT of money, if they invested in scripting knowledge for their admins, instead of buying third-party tools.

Wed, Jun 30, 2004 Daniel Houston

I have started working with some VB scripts but the inveronment that I work in doesnt have file and printer sharing turned on. While VB is easy to use makes it hard for me to push out some of the scripts. Does anyone know of a scripting language that works well with file and printer sharing turned off?

Daniel

Wed, Jun 30, 2004 Luis Anonymous

I wouldn't recomend Vbscript, since it's just one of those technologies that have been left asside by Microsoft, but I would highly recomend python. What's more, python is not only a scripting language but a full featured programing language in its own right. And for those who say that python can't compete with fully compiled static-typed languages, check the latest projects for language implementations: Ironpython (Python for .NET) and Starkiller (a static type inferencer and c compiler for python whose with the goal of making python as fast as c).

Tue, Jun 29, 2004 Charlie Boston

Very useful. I realize that I'm in the same boat as Chuck but have been putting off learning a scripting language. I was pretty sure that VB Script would make sense for me to start with, so I purchased the book that Bill recommended. Also, the information about Python is exactly what a Unix Admin recently told me. I hope to move on to that eventually.
Thanks

Tue, Jun 29, 2004 Anonymous Anonymous

Python is an ideal choice. It is small, fast, has many useful windows-related modules and API's wired in. Most important to me is it supports (but doesn't require) object-oriented programming, making it very scalable.

Tue, Jun 29, 2004 Jeff Cooper Anonymous

Thanks for the tips on scripting. Personally, I don't think I'll ever take the time to learn, since I'm an old educator and end user. BTW... don't use tinyurl anymore... snipurl.com rules. Register (free) and you can create your own edited redirects... and everything is saved.

Add Your Comment Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above

Redmond Tech Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.