AD users manage
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
In a windows 2003 domain I need manage AD users by vb script.
I write this script to find a users and set it disable:
dtStart = TimeValue(Now())
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<
LDAP://dc=pippo,dc=it>;(&(objectCategory=User)" & _
"(samAccountName=" & matricola & "));samAccountName;subtree"
Set objRecordSet = objCommand.Execute
'Disabilita l'utente
objUser.AccountDisabled = True
'true disable; false enabless
'objConnection.Close
What's wrong in this script?
Many Thanks
.
Relevant Pages
- Re: Get ADsPath W2K user
... I am trying to search a Windows 2000 domain for users, ... The script contains the following code: ... Set objConnection = CreateObject ... strField = objRecordSet.Fields ... (microsoft.public.scripting.vbscript) - Re: Query AD and for each machine frin out the adobe version
... Const ForWriting = 2 ... Set objConnection = CreateObject ... When I run the script it goes to the first machine and echos the version ... almost always is the same as the NetBIOS name, ... (microsoft.public.scripting.vbscript) - Re: VBS Logon and move computer script
... tested the script below, but it uses ADO to retrieve info on all computer ... Set objConnection = CreateObject ... Set objRecordSet = Nothing ... > Wscript.Echo strComputer & "Computer exists in Computers" ... (microsoft.public.windows.server.scripting) - Re: Get ADsPath W2K user
... I run the script in which I have adapted according to your suggestions, ... Set objConnection = CreateObject ... WScript.Echo strField ... I am trying to search a Windows 2000 domain for users, ... (microsoft.public.scripting.vbscript) - Re: Cross Child-Domain Scripting
... OR to be able to span child domain LDAP look ups in the same script. ... Set objConnection = CreateObject ... If Err = "0" Then ... (microsoft.public.scripting.vbscript) |
|