Create a Windows Scripting Host (WSH) automation object / run an external command.

      Set objObject = Wscript.CreateObject(ServerName.typeName, [Location])


   ServerName   The name of the application

   typeName     Type or class of object to create

   Location     The name of the server. 


Run a cmd command from vbs

Set objShell = Wscript.CreateObject("Wscript.Shell")"%comspec% /c ipconfig /release")

Run a cmd batch file from vbs

Set objShell = Wscript.CreateObject("Wscript.Shell")"%comspec% /c mybatchfile.cmd")

Create a WshController object to run scripts on a remote machine:

strServer = "machine_name"
strScript = "script_name.vbs"
Set objWshController = WScript.CreateObject("WshController")
Set objRemoteScript = objWshController.CreateScript(strScript, strServer)

For the above to work, enable DCOM , then enable WshRemote in the registry:

HKLM\Software\Microsoft\Windows Script Host
String value: Remote

Set Remote to "1" to enable WshRemote and "0" to disable.

Create a WshNetwork object (for mapping to a network share)
WshNetwork = WScript.CreateObject("WScript.Network")

Echo the script mode.
WScript.Echo (WScript.Interactive)

“ understanding of Visual Basic would be advantageous although not to a programming level.” ~ Job advert on


cscript - Run a VBScript .vbs file
.Exec - Run a command
.GetObject - Get an Automation object
psExec - Run commands remotely
Equivalent in Powershell - New-Object

© Copyright 1999-2015
Some rights reserved