Group Policy to Disbale Users

S

Sav

Is there a way that I can create a group Policy that is linked to an OU
inwhich when I move a user to that OU the policy will automatcially disable
that user? For example, If I have an OU called "Disabled Users" every user I
add to this OU will be disabled.
 
K

Kurt Roggen

Schedule a script on a dc that runs every x time.
It's job: disable all account found in your OU "Disabled Users"

Script could like this:
On Error Resume Next

Const ADS_UF_ACCOUNTDISABLE = 2
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D

Set objOU = GetObject ("LDAP://ou=Disabled
Users,cn=Users,dc=NA,dc=fabrikam,dc=com")
ObjOU.Filter= Array("user")

For Each objUser in objOU
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
Next
 
K

Kurt Roggen

Oeps, missed this posting.
Batch could be using dsquery.exe to get users and redirect output as input
for dsmod.exe
dsquery user "params" | dsmod user "params"
--
Kurt Roggen
http://blogontheweb.com/roggenk


"Jorge de Almeida Pinto [MVP - DS]"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top