What is VBScript?
- VBScript is a scripting language
- A scripting language is a lightweight programming language
- VBScript is a light version of Microsoft's programming language Visual Basic
- VBScript Statements and Comments
- Multiple lines are specified using ":"
- For continued lines use "_"
- Comments using “'”
WSH (Windows Script Host )
- To check version is installed Run “CScript.exe”
- A script host is a program that provides an environment in which users can execute scripts in a variety of languages. Examples are Internet Explorer, Command Prompt
- WshShell (Shell Object)
- WshNetwork (Network Object)
- WshController (Controler Object)
Built-In object :WScript
- Using COM objects
- Handling input and output
- Working with command-line arguments
- Controlling script execution
- Obtaining WSH environment info
COM Object : Wshshell
- Running programs
- Working with shortcuts
- Working with Environment variables
- Working with Registry
- Sending keystrokes to an application
The WshNetwork Object provides your scripts with the ability to work with network drives, printers and provides information about the currently logged on user
COM Objects : WshController Object
- One limitation of WSH - scripts could only be run locally .They could not be run against remote computers.
- The WshController object, introduced in WSH 5.6, provides that capability.
- The WshController object allows you to create a controller script that can run worker scripts against remote computers. The controller script initiates, monitors and the worker script carries out the task
- The script that runs on the remote computer is never saved to disk on the remote computer. Instead, the WshController object starts the script within a WSH process in the memory of the remote computer
- WshController Object - Setup Required
WMI(windows management instrumentation)
- WMI is the management enabling technology built into windows 2000,XP & 2003 family of operating systems. Through WMI all the windows resources can be Accessed, Configured, Managed and Monitored.
- There are three steps used in the scripts to retrieve information about a WMI managed resource.
- To establish a connection to the windows management service on the target computer
- To retrieve the instance of WMI managed resource
- To retrieve the properties or set the properties
Accounts & Domains (Win32_ComputerSystem)
Additional Important Objects in the vbscript and its uses MSI
- Dictionary Object
- Drive Object
- File Object
- FileSystemObject Object
- Folder Object
- TextStream Object
Reading MSI Properties Using VBScript
- Copy,delete,modify(append data in text files,remove hardcoding,rename) files
- Create,delete,update,restore registries
- Terminate process
- Mapping and checking exsistence of Network Drives
- Resolve Public Property and Environment String