10 items | 36 visits
Different tips for several scripting languages
Updated on Mar 22, 08
Created on Mar 22, 08
Category: Computers & Internet
URL:
On Error Resume Next strComputer = "fictional" Set objWMIService = GetObject("winmgmts:\\" & strComputer) If Err.Number <> 0 Then WScript.Echo "Error: " & Err.Number WScript.Echo "Error (Hex): " & Hex(Err.Number) WScript.Echo "Source: " & Err.Source WScript.Echo "Description: " & Err.Description Err.Clear End If Typical output:
On Error Resume Next Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D Set objOU = GetObject _ ("LDAP://cn=Users,dc=NA,dc=fabrikam,dc=com") ObjOU.Filter= Array("user") For Each objUser in objOU Wscript.Echo objUser.cn & " is a member of: " Wscript.Echo vbTab & "Primary Group ID: " & _ objUser.Get("primaryGroupID") arrMemberOf = objUser.GetEx("memberOf") If Err.Number <> E_ADS_PROPERTY_NOT_FOUND Then For Each Group in arrMemberOf Wscript.Echo vbTab & Group Next Else Wscript.Echo vbTab & "memberOf attribute is not set" Err.Clear End If Wscript.Echo VbCrLf Next
Set objConfiguration = GetObject _ ("LDAP://cn=Configuration,dc=fabrikam,dc=com") For Each objContainer in objConfiguration Wscript.Echo objContainer.Name Next
VbsToExe is a command line application that converts VBScript files into an executables.
The created program executes the VBScript-code from memory using Ms-ScriptControl.Usagevbstoexe [ -c | -e ] { -p "password" } [ VBScript | Script-Exe ]
-c -- [convert the VBScript file into an executable] -e -- [extract the source] -h -- [print help] -p -- [protect the program with a password] -v -- [print version]
Enumerate files in folder and subfolders.
10 items | 36 visits
Different tips for several scripting languages
Updated on Mar 22, 08
Created on Mar 22, 08
Category: Computers & Internet
URL: