Question Locked

Script to disable bulk user account

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

On daily basis i have to disable user accounts from AD; hence I am looking for vb script to disable user accounts using csv/excel file.

Can anybody pls help me??

Andy

6 replies

by coolandy.net

I have checked out there and found one simple script using which i can disable one account at a time.
What i am looking at is searching user accounts with there username inserted into a file and disable that ID.
I am not a scripting guys hence seeking help..
pls reply...

by gv.kumaran

Have u got the VB Script, how to disable multiple users in AD ?

YOU CAN USE THE BELOW GIVE SCRIPT
DISABLE.TXT SHOULD CONTAIN DN ( distinguishedName )

PLEASE REPLY IF THIS DIDN'T WORK.
IT WORKS FOR ME VERY WELL.
VASANTHA
===========================
Set fp = Createobject("Scripting.Filesystemobject")
set fpt1 = fp.opentextfile("c:\disable.txt")

rdata = fpt1.readall
data = split(rdata, vbcrlf)

for each i in data

Set B = getobject ("LDAP://" & i )
intUCA = B.get("useraccountcontrol")
B.put "useraccountcontrol", 1
'B.hidefromaddressbook = True
B.setinfo

Next
Wscript.echo "Done"

by encounterking

is it required to put the whole LDAP address of the OU of the user ?
Or should i run it the way you have posted it here ? i get an error at :

*Set B = getobject ("LDAP://" & i )*

This discussion is closed to new replies.