Thursday, June 01, 2006

VBScript header...

And while we're on the topic of VBScript, here is what I currently use for a standard script header:

Dim objFSO,objShell,objWMI,objRegEx,strSystemRoot
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set objRegEx = New RegExp
objRegEx.Global = True
objRegEx.IgnoreCase = True
strSystemRoot = objShell.ExpandEnvironmentStrings("%SYSTEMROOT%")

No comments: