I got an e-mail this morning from reader Bert Rivera:
I’m a long time reader of your columns on ZDNet and edbott.com. I’ve been a network administrator for 16 years but never got into programming. I’ve written batch files here and there but nothing real involved.
Over the years, the simple batch files I’ve done have met my needs, but lately there have been a few things that batch files couldn’t do and I would like to know if you can recommend some books on scripting for beginner/intermediate users. Any help would be appreciated.
That one stumped me. Although Carl, Craig, and I touch on scripting and batch files in our Inside Out books, we don’t go into much depth on the topic, and I haven’t had the time to really dive into scripting and other development areas in the past few years.
If I were going to get started with scripting these days, I’d probably focus on PowerShell, and I’d most certainly start by poking around at the Microsoft Script Center, which has a Getting Started page and a Windows PowerShell portal.
I’d also devour the Hey, Scripting Guy! archives, which are well written and practical.
To get a good Scripting 101 book, I suppose I’d start at Amazon.com and read the reviews. But I’d rather read some up-to-date real-world reviews from you all, especially if you can point out a book that really helped you get over this same hurdle. In fact, if you’ve written a scripting book and you want to plug it here, be my guest.
Hello,
I’m Bert, the guy Ed is talking about. I did what Ed suggested in the last paragraph and was overwelmed by the number of books on this subject. I went through 2 pages reading the reader reviews before I stopped and contacted Ed.
I want to thank Ed and everyone else in advance for your help.
Bert
The Script Center and The Scripting Guys are good starts and I also agree that if you’re going to start today you should focus on Powershell. The #1 educator for scripting, and he’s written a few good books, is Don Jones. He does some Microsoft webcasts that you can sign up for but you should really pick up one of his books. His website is http://www.scriptinganswers.com/
The forums at Microsoft (A link is at the scripting guys) or Windows IT Pro is a good place to look as well. The forums at WITP are free, the VIP Scripting site is not.
I also highly recommend getting up to speed on Powershell.
If you want to learn some of the older Windows Scripting Host technologies “Scripting Windows 2000” is the best book I ever read on the topic (http://www.amazon.com/Scripting-Windows-Network-Professionals-Library/dp/007212444X). Don’t be put off by the “Windows 2000” part of the title, the content is just as applicable to XP, Vista and the Server OS’s. It covers Batch, VBScript, JScript, WSH, WMI, and ADSO. Great stuff.
Great topic. I too have been a long time Systems Admin who has only skimmed the surface of scripting, so I’m eager to read the resources people come up with here.
Haven’t had time to get up-to-date on PowerShell myself, but if you want a peek at an MS Press book (a few sample chapters), you can go here: https://www.microsoft.com/learning/windowsserver2008/default.mspx#
Scroll down and look for Books from Microsoft Press in the table.
There are at least two good free GUIs out there (see http://www.wintellect.com/CS/blogs/jrobbins/archive/2008/02/17/eight-weeks-of-powershell.aspx)
Good luck!
In a sense there are two kinds of scripting; the VBScript basics and standalone systems at one level and then there is WMI scripting for networks. Recent books that I am aware of are mostly heavily oriented to WMI and would be hard-going for someone unfamiliar with VBScript. One possibility is Microsoft Windows Scripting Self-Paced Learning Guide by Ed Wilson. Personally, for beginners, I like Windows Script Host by Tim Hill (New Riders) mentioned by Nathan Stohlmann above. I didn’t know if it was still in print. Also I agree with others that the Microsoft site has some good stuff.
Oops! Stohlmann’s book is a different one. The book I mentioned also was written for Windows 2000 but is still applicable.
Bert, I am kind of in the same boat you are in as well with trying to expand my scripting skills.
Don Jones and Scripting Answers are invaluable resources.
The Scripting Guys have great columns and are a great resource as well.
Although, I have seen a lot of recommendations to learn Powershell, I am not sure that is the path you need to explore at this point. Powershell will allow you to leverage heavy capabilities, but will require you to install on all of the machines that you will run your scripts on, and to digitally sign those scripts for authorized code. You will need to learn Powershell at some point especially for Exchange Server (and I assume for Windows 7) but you need a good foundation to really get the most out it.
I am guessing that you are trying to learn VBS and WMI for automation and sysadmin tasks. I would reccommend a couple of more resources for you to get started.
First, pick up a copy of Microsft Visual Basic Step by Step.
This will help you get a foundation for your syntax and language.
Next, pick up a copy of Ed Wilson’s Windows Scripting (various versions available, all of them tend to go over the same things, but with a different focus on the advanced areas).
Wilson does a good job of highlighting the basic sysadmin tasks, but tends to throw you into the water for a sink/swim exercise, and that’s why I found the Visual Basic step by step an invaluable resource. It helped me with more of the Syntax/Language.
Of course, keep in mind with all scripting, find the best tool for the job. If a batch script can accomplish your goals quickly, then use it.
It certainly is useful to know vbscript, if you are starting out now though I would go with Powershell. A good book is “Windows Powershell in Action” by Bruce Payette.
While the default for Powershell is to not allow scripts to be run at all, it can easily be configured to not require signing (help about_signing) and you can associate .ps1 with powershell so that a powershell script will run just like a batch file.
I recommend keeping execution restricted on your servers, but on your own workstation I wouldn’t worry about opening it up so that it plays at the same level as your .vbs, .bat, .cmd, and .exe files.
It’s power and flexibility blows away what you can do with vbscript.
Bruce
If I were new to scripting, then I believe I would learn Windows PowerShell as it is the “future” of scripting, at least from a Windows perspective. Depending on what you are trying to do, PowerShell will allow you to do it quicker and faster. However, there are some things you can not yet do with PowerShell such as scripting OS builds while using WinPE, as it does not yet have support for PowerShell. Keep in mind that PowerShell is a new product, and as such is only going to get better, PowerShell 2.0 (currently in beta) absolutely ROCKS!!!
One of the things I love about PowerShell is that often I do not need to write a script at all. Things that in VBScript would have taken 5 lines of code, can be done with simply one line of code typed into the console. PowerShell was designed to be used by network administrators and as such is easier to learn than VBScript.
As for learning Windows PowerShell you can certainly download it for free, and start playing with it. Use the Get-Help command and start reading the help files. If you would like a more detailed reference type book, then either Bruce Payettes book or my “Windows PowerShell Scripting Guide” book by MSPress would fit the bill nicely. If you would like a nice step by step kind of book that has exercises, and detailed learning objectives, I hope you would consider my “Microsoft Windows PowerShell Step by Step” book. It is the one I use when teaching classes. Hope this helps. Ed Wilson
I had a long comment with links and such but it got absorbed by the spam filter.
In any case, Bruce Payette’s book is the bible of PowerShell but it is dense reading. To get you started there are a number of blogs that have tutorials as well as Microsoft’s ‘The Scripting Guys’ articles like PowerShell Tip of the Week and the PowerShell Owener’s Manual.
I have them linked off a post if the anti-spam stuff doesn’t eat this one as well.
http://www.blkmtn.org/powershell-tutorial-series
Be aware that there is a Community Technical Preview (CTP) for PowerShell v2 (CTP is equivalent to an alpha release). When it is blogged about the authors generally identify it as such, so don’t get confused on features and capabilities.
Ed Wilson’s book is a solid guide and in many ways better for a beginner then Bruce’s.
PowerShell is the future administrative scripting language of choice for Microsoft in many ways and unlike vbScript, it’s fun.
Steven Peck