Loading...

VBScript

VBScript is a powerful scripting tool that can automate tasks in Active Directory. This video provides an introduction to what can be achieved using VBScript.

VBScript
VBScript was released back in 1996 and thus is supported in all operating systems since Windows 95. In the older operating systems it is available as an additional download, with the newer operating systems it comes pre-installed. VBScript is based on Visual Basic so those that have programmed in Visual Basic should not have any problems writing scripts of VBScript. VBScript has also been included in applications like Internet Explorer and Office. With the popularly of VBScript and the amount of time it has been available, there are a lot of examples of VBScripts available.

VBScript vs PowerShell
PowerShell was designed to replace VBScript addressing some of the limitations of VBScript. PowerShell requires .Net 2.0 to operate and thus can only be used on Windows XP and up. The big difference with VBScript and PowerShell is that PowerShell has a shell like the command prompt does. This means that individual commands can be run, unlike VBScript where the whole script needs to be run at once.

Demonstration
The following VBScript can be used to create a user in Active Directory
set objOU=GetObject(“LDAP://OU=Users,OU=New York,DC=ITFreeTraining,DC=Local”)
set objUser=ObjOU.Create(“user”,”CN=John Doe”)
objUser.put “sAMAccountName”,”John Doe”
objUser.SetInfo()

Visual Basic Scripts can be run from the command line or by double clicking on them. If you run them by double clicking them, a dialog box is created each time a message is outputted. If you want this output to go to the command line, you can run cscript followed by the filename of the script that you want to run. Cscript is used to run scripts and will have the output directed to the command prompt rather than a dialog box for each message.

References
“MCTS 70-640 Configuring Windows Server 2008 Active Directory” pg 108 – 110
http://itfreetraining.com/Handouts/70-640/Part2/CreateUser.vbs
http://itfreetraining.com/Handouts/70-640/Part2/AuditPC.vbs

Theme developed by TouchSize - Premium WordPress Themes and Websites