Computer Performance, VBScript

Guy recommends :
Free Permissions
Analyzer Tool

Solarwinds Free Download of Permissions Analyzer

View the effective permissions for a folder or shared drive. Free download try it now!


VBScript - For Windows Networks

Introduction to VBScript

This section provides you with free tutorials of VBScripts for Windows Server and XP and Windows 7/8.  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.  View WMI as a pipe connecting magically to the secret inner cave of the Microsoft operating system.  This is a section for techies who want VBScripts to remotely control of their Windows networks.  Study root\cimv2 here:

Guy Recommends: WMI Monitor and It's Free!Solarwinds Free WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft's operating systems.  Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your scripts.

Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory or Exchange Server. Give this WMI monitor a try - it's free.

Download your free copy of WMI Monitor

Why Script WMI with VBSCript?

One application for writing WMI is scripts is for hardware inventories.  For example, how many of our computers chassis are Desktops and how many are 'Pizza Boxes'? What are the cooling fans' specifications on the servers?  Who are the disk manufacturers of our servers in the Worcester office? 

For this and similar tasks, WMI has dozens of objects and hundreds of methods here are three examples:

  1. Win32_SystemEnclosure - What type of chassis does your computer have?  See this week's script.
  2. Win32_Keyboard - Worth a look.
  3. Win32_SystemBios - See if there have been upgrades.

General Scripting Techniques

Each script has two missions:
a) A practical task that reveals properties of the Windows operating system.
b) A theoretical technique to demonstrate a pure VBScript command.

 

  • Binding to Active Directory
  • Object based model
  • Writing to files with FSO
  • Select Case
  • For ... Next loops
  • If ... then Else ..  End if logic
 
  • Error-correcting code
  • On Error Resume Next
  • WScript.Echo
  • InputBox

Guy Recommends: SolarWinds Free Wake-On-LAN UtilitySolarwinds Wake-On-LAN

Encouraging computers to sleep when they're not in use is a great idea - until you are away from your desk and need a file on that remote sleeping machine!

WOL also has business uses for example, rousing machines so that they can have update patches applied.  My real reason for recommending you download this free tool is because it's so much fun sending those 'Magic Packets'. Give WOL a try - it's free.

Download your free copy of SolarWinds Wake-On-LAN

VBScript Background

VBScript in Windows Server 2003/8 conforms to the classic Object programming model.  Objects such as Users have properties for example 'givenName' and 'description'.  The most interesting part is the methods because they are used to manipulate the object, for instance, GetObject, CreateObject and ConnectObject.  More often than not, the goal of our script is to set a value for a particular properties, for example Object = User, Property = givenName, Value = Guy.

It can be hard to pin down VBScript.  There are no stand-alone executables, you do not compile VBScript as you would with C++.  How does it work, I can hear you asking.  Well VBScript works through a host WSH which reads plain scripts, compiles them and runs them.  This means what ever is in those scripts is what gets done.

 

 

 *


Custom Search

Site Home

Guy Recommends: WMI Monitor for PowershellSolarwinds WMI Monitor

Windows Management Instrumentation (WMI) is most useful for PowerShell scripting.

SolarWinds have produced this Free WMI Monitor to take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

Author: Guy Thomas Copyright © 1999-2014 Computer Performance LTD All rights reserved.

Please report a broken link, or an error to: