Wednesday 20 July 2011

VB Scripting - Part 1

Scripting is just a way to automate getting information to and from your computer (and other computers).
This is the very first thing you need to know to start using scripts to manage your Microsoft Windows systems. On the Script Center (and possibly elsewhere on the Internet, but we can’t vouch for anyone else), you’ll find a lot of pre-made, ready-to-go scripts. A script will look something like this:
Wscript.echo "My very first script."
Yes, that one line is a script. It’s a very simple script, most are longer than this, but it’s still a script. Now you might be wondering what to do with that one line. It’s very simple:
• Open Notepad.
• Copy the script from your browser and paste it into Notepad.
• Save the script with a .vbs extension, such as test.vbs.
Now double click the file test.vbs
If you did this with the script above, you’ll have output that looks like this: My very first script.
Our first script did this: we gave a sentence to the computer and got the same sentence back from the computer. This may not seem like an especially useful feature, but this was just a first step, and one step doesn’t even get you all the way across the room, let alone out the door.
Mr. Amol Vaidya (Technical Director, WIS) always says “If you need to do one task more than one time, just write a script for it”.
There are a number of scenarios where scripts start to get really useful. Here are just a few:
•You have to perform a series of system administration tasks on a regular basis
•You have to perform a series of system administration tasks on several computers
•You want to consolidate and organize the output you get from the computer
•You want to run tasks when you’re not there to interact with the GUI
If you think about some of the work you have to do as a system administrator, you might already be imagining tasks you want to script.

No comments:

Post a Comment