July 20, 2008: Windows Scripting and CLI Reference Gold
I consider scripting to be an essential skill for a serious sysadmin. Anything you’ll have to do more than twenty times in a row is likely to lead to repetition fatigue: one or more times you’ll make some little mistake, do things a slightly different way. Scripting means spending a bit more time at the beginning, but guarantees that the results are always predictably the same. That’s a good thing even when your script screws up, because you know the same mistake was made all 20 times, and that’s a lot easier to find and correct than a random human error which was made twice within those 20 iterations.
If you’re scripting in Windows with WSH, VBscript, Jscript, or PowerShell, here are the core web references you’ll need. Googling can actually slow you down or give you bad/wrong information. These are the canonical references and they are always correct and complete. Learn to navigate these, and you’ll become a much better scripter in short order.
- Windows Scripting Reference. This is the heart of the VBscript/Jscript/WSH stuff. The part I go back to over and over again. Better than having a book at your elbow, since you can cut and paste instantly. Pay close attention to the table of contents (TOC) at left side. Illustration below highlights the most valuable bits.
- WMI and PowerShell References. These are faster to get to from this link. Again, core stuff. And again, note the TOC at left. This is how to quickly get to the bits you need.
- CLI reference. Here I chose ss64.com - quick and concise. Not fully comprehensive, but still a great reference point.
- Windows 2000 Scripting Guide. A whole book online, starting with primer guides and moving to more advanced scenarios and examples of WSH, VBScript, WMI, and ADSI (Active Directory) scripting. Don’t let the Windows 2000 in the title fool you. All of this stuff will work on Windows 2000 and above.
- Script Center. A series of articles and references for a scripter at any level from beginner to guru.
- Script Repository. This is part of the above Script Center, but deserves its own link. Here you’ll find a well-indexed set of examples suitable to quite a few sysadmin tasks.

Some folks prefer books. I’ve spent a lot of money on scripting books, but there are four books I refer to over and over and over again, while the others mainly collect dust. Here are those books and their Amazon links:
- Windows Script Host by Tim Hill. Excellent tutorial and reference to WSH and VBscript.
- VBScript In a Nutshell by Matt Childs, Paul Lomax, and Ron Petrushka. Where Tim Hill’s book takes a wider ‘learn the basics’ stance on VBscript, this O’Reilly nutshell book drills in with laser focus onto the specifics of every statement, object, method, and so on. The ‘tips and gotchas’ notes for each item are helpful. However, much of what you’ll find here is a rehash of the info found on websites linked above. A great and helpful rehash to be sure! But I go to the above web links first, and dig into this book only if I am still confused.
- Windows NT Shell Scripting by Tim Hill. There quite simply is no better book on native CMD scripting for Windows. This book explains syntactical issues that might have driven you nuts. It turns chaos into order. It is the single book I refer to most often, because cmd works everywhere, and for me, is the quickest way to a finished script, 80% of the time.
- Windows PowerShell In Action by Bruce Payette. I have to admit that I haven’t really given PowerShell as much attention as it deserves - yet. My excuse is that until it is natively installed on all the systems I will visit, CMD and WSH scripts are more instantly valuable. But PowerShell’s time is coming, and this looks to be the core book for understanding it.
And there you have it. Within these topics, I probably have 50-60 pounds of books on my shelves. Several hundred dollars, several feet of linear bookshelf space expended, and with the above exceptions, it all goes pretty much unused. With these six links and (optionally!) these four books, you can become the goto scripting guy/gal for your company.