Way back in the early 90’s, I found myself in the Marine Corps Computer Science School where I was being trained to be a computer operator. Evidently the Marine Corps thought I would be good at this computer thing. Their definition of a computer operator was the guy who maintained the print queues, watched and fixed production jobs, and mounted tapes on a mainframe.
There was this big debate at the time about who was better, operators or programmers. The programmers were the ones who wrote the code which did all the nice things, and the operators were the one who made sure that those jobs ran correctly, and fixed everything when they didn’t work.
When I thought about programming, I just didn’t think that it was for me. As I matured, I took some programming courses in college, and it was interesting, but it still didn’t seem like something that I wanted to do for a living.
About a year ago, I started dabbling with some scripting. This was really lucky timing for me, since Microsoft really started putting some man power into educating the public about their scripting technologies. I found the “Hey, Scripting Guy!” column, and I realized that with what I had already learned with Visual Basic, and looking at my text book (whew, I sure am glad that I didn’t sell that one), I could really do some cool stuff.
The thing that really makes me enjoy scripting is that the programs aren’t being used by everyone in the world, so I don’t have to validate everything that is entered. If I use a command line argument, I don’t need to make sure that it is only so many characters, or that it is a numeric value. I write the scripts for myself, or for a very limited audience, and if I don’t know what to expect from it, then I guess I shouldn’t be using it. Don’t think that I don’t check and double check the results of my scripts, because I do need them to be accurate.
The beauty of a script is that if you do something over and over, a script can probably do it for you, faster, sometimes better, and all you have to do is double click on it, or better yet, schedule it to run periodically. If it takes you four hours to write a script to do a task which usually takes you 10 minutes to do manually, then it will pay for itself after being used 24 times. I wrote a script called “tap” that will ping the computer I specify 1 time. It took me probably 10 minutes to write it, but now instead of typing “ping computer –n 1” I just type “tap computer”. I know that might seem a little silly, unless you ping computers 20 times a day, then you may think it is pretty useful. Heck, I have a batch file called “x” that just types “exit”, it saves me 3 keystrokes, but I use a command prompt about 100 times a day.
I write all of my scripts for Windows based computers, and you can write scripts in all sorts of languages, but I use Visual Basic Script. Visual Basic is not the same as Visual Basic Script, but it is close.
Now the bad part about being a novice is that sometimes, I really have to bang my head on stuff before I figure it out. The other side of that is every time that I really bang my head on stuff, I learn something, and I get better.
As far as actually writing the scripts, I know that the hard core scripting guys will say that all you need is a text editor like notepad, and yes, that is all you need. I have heard the same thing over and over about writing HTML. I still see a great benefit in using a nice editor. I know that there are some really nice editors out there with great features, but I don’t much like spending money on stuff if I don’t have to. The editor I use is Crimson Editor, it’s free, and I like it. If you happen to know of a better one that is free, post a comment.
Now I don’t want you to think that I am some scripting Guru, I don’t do this to make a living, I do this to make my job easier, and I thought it might be useful to make this available to others. Also, when you are looking at my scripts, I would not use them as a reference on how to write code. Let me repeat this one more time, I am not a programmer.
The first place that I would like to point you to is the Microsoft Script Center. This is one place where you will find some really good scripting resources. I love to take scripts out of the Script Center Repository, and modify them just a little tiny bit, or better yet, use them as a sub routine in another script. Another favorite thing to do is to get a wrapper template, for an example, a script that grabs all of the computers in my domain, then throw in another script, that checks them all for a particular version of office. So in just a few minutes, I can check all of the computers on my network for office.
Another terrific thing about scripting is that I will create a script for one purpose, and then the next script I write I figure out that I can use the first script again. The next thing you know, I am using that script as a sub routine in a whole slew of other scripts.
OK, I already gave you a few links, so let me pile on some more. The “Hey, Scripting Guy!” column is a great place to find solutions for problems that you didn’t even think about solving with a script yet. The Microsoft Developer Network has a bunch of resources, especially if you want to start modifying scripts or even creating your own. The Scripting section of MSDN has a huge amount of Resources, including the VBSCRIPT Language Reference and User Guide, a reference for Windows Scripting Host (WSH), The Windows Management Instrumentation (WMI) Reference, and of course the Active Directory Service Interfaces Reference.
That should be enough to get you started. Good luck.
Find Scripts:
- “Hey, Scripting Guy!” – Terrific Column at Microsoft Technet.
- Script Center Repository – Lots of great Scripts from Microsoft.
- ScriptingAnswers.com – Lots of good scripts.
- W32Scripting – Many more good Scripts.
Scripting Resources
- Scripting Section of MSDN
- Microsoft Script Center - Lots of Resources, and tons of tutorials and columns.
- VBSCRIPT Language Reference and User Guide
- Windows Scripting Host (WSH) Reference
- Windows Management Instrumentation (WMI) Reference
- Active Directory Service Interfaces Reference