background preloader

Scripting

Facebook Twitter

HTML / CSS

Scripting: Your First Steps. By The Scripting Guys A long time ago, even before any of the Scripting Guys were born, people used to walk from one place to another.

Scripting: Your First Steps

Not for exercise or recreation, but because they had to get somewhere. Those who were fortunate enough to have other forms of transportation could move along a little more quickly on their horses, camels, elephants, or whatever the local pack animal happened to be. (And to those of you still using any of the preceding as your primary mode of transportation—we’ll be thinking of you the next time we’re stuck in traffic.) Then this thing came along known as the horseless carriage. People today have experienced some of the same reactions to scripting as those people had to cars all those years ago.

Step 1 This is the very first thing you need to know to start using scripts to manage your Microsoft Windows systems. Wscript.echo "My very first script. " Yes, that one line is a script. If you did this with the script above, you’ll have output that looks like this: VBScript Tutorial - Functions. When you are programming in VBScript and other languages you may find that you have to program the same code over, and over, and over.

VBScript Tutorial - Functions

This is usually a sign that you should be using a function to reduce this code repetition. Besides that, functions are also useful to increase code readability (when done right). Nearly all the programs that you write will benefit from functions. Whether you use the pre-made functions like document.write() or make your own it is a necessity for any programmer to have a basic understanding of how functions work in VBScript.

Let's start off with a really simple example to show the syntax for creating a function. VBScript Code: <script type="text/vbscript"> Function myAdd(x,y) myAdd = x + y End Function 'Let's use our function! Display: This may not look that complex, but there is actually quite a lot going on this simple example. When our VBScript code executes it first stores the function for later use, then reaches result = myAdd(10,14). Free example scripts VBScript, Windows Active Directory Tutorials. This section provides you with free tutorials of VBScripts for Windows Server and XP and Windows 7/8.

Free example scripts VBScript, Windows Active Directory Tutorials

Many of the scripts are designed to create and manipulate Windows Active Directory objects. Each page has a tutorial explaining the methods you need to tackle a particular every-day network task. In addition to the scripts themselves, I provide learning points to explain how the VBScript builds objects such as Users, Computers and Groups. Please treat this page as a mini sitemap for free VBScript examples. VBScript Sections Windows Server 2003/8 Active Directory Example Scripts Creating and Controlling Files with FSO (Scripting.FileSystemObject) Registry RegRead - Introduction to RegRead RegRead - Read the Registry Advanced WMI (Windows Management Interface) WMI gives you the power to automatically collect hardware and software data.