Set oOU = GetObject("LDAP://...")
GetObject is actually a function that returns the object you have given the ADSPath to. That function is one that is built-in, you don't actually see the code behind it.
x = 1
data = cstr(x * 2) & " apples"
wscript.echo data
x = 2
data = cstr(x * 2) & " apples"
wscript.echo data
x = 3
data = cstr(x * 2) & " apples"
wscript.echo data
Process 1
Process 2
Process 3
Sub Process(x)
data = cstr(x * 2) & " apples"
wscript.echo data
End Sub
...
oNetwork.RemoveNetworkDrive "P:", True, True
oNetwork.MapNetworkDrive "P:", "\\server\share", True
If Err.Number <> 0 then
MsgBox "Error mapping drive. Please contact the administrator."
Err.Clear
End If
oNetwork.RemoveNetworkDrive "Q:", True, True
oNetwork.MapNetworkDrive "Q:", "\\server\share2", True
If Err.Number <> 0 then
MsgBox "Error mapping drive. Please contact the administrator."
Err.Clear
End If
oNetwork.RemoveNetworkDrive "R:", True, True
oNetwork.MapNetworkDrive "R:", "\\server\share3", True
If Err.Number <> 0 then
MsgBox "Error mapping drive. Please contact the administrator."
Err.Clear
End If
Sub MapDrive(DriveLetter, NetworkPath)
On Error Resume Next
oNetwork.RemoveNetworkDrive DriveLetter, True, True
oNetwork.MapNetworkDrive DriveLetter, NetworkPath, True
If Err.Number <> 0 then
MsgBox "Error mapping drive. Please contact the administrator."
Err.Clear
End If
End Sub
MapDrive "P:","\\server\share"
MapDrive "Q:","\\server\share2"
MapDrive "R:","\\server\share3"
Function AddTogether(x,y)
AddTogether = x + y
End Function
q = AddTogether(2,3)
wscript.echo q
wscript.echo AddTogether(2,3)
Function IsLocked(UserDN)
Set oUser = GetObject("LDAP://" & UserDN)
Set oLockout = oUser.Get("LockOutTime")
If Err.Number = -2147463155 Then
IsLocked = False
Exit Function
End If
If oLockout.LowPart = 0 and oLockout.HighPart = 0 Then
IsLocked = False
Else
IsLocked = True
End If
End Function
If IsLocked("CN=John Doe,OU=Employees,DC=domain,DC=local") Then Wscript.Echo "Locked"
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)