bsharath
asked on
Disable and enable all users in a OU.
Hi,
I want a script with which i can disable all users in a OU .And a way to enable the same when required.
Is there a way to do this.
Regards
Sharath
I want a script with which i can disable all users in a OU .And a way to enable the same when required.
Is there a way to do this.
Regards
Sharath
I am not sure if this works.Can you highlight all the users at once and right click to see if you get the option to disbable the users.
ASKER
I get this.
C:\>dsquery user OU=CMS,OU=External Users,OU=User Accounts,OU=Countries,D
C=Development,DC=Group,DC= co -limit 0 | dsmod user -disabled yes
dsquery failed:`Users,OU=User' is an unknown parameter.
type dsquery /? for help.dsmod failed:`Target object for this command' is missin
g.
type dsmod /? for help.
C:\>dsquery user OU=CMS,OU=External Users,OU=User Accounts,OU=Countries,D
C=Development,DC=Group,DC=
dsquery failed:`Users,OU=User' is an unknown parameter.
type dsquery /? for help.dsmod failed:`Target object for this command' is missin
g.
type dsmod /? for help.
Try this:
DSQuery user "Distinguished Name" -name * -Limit 0 |DSMod user -disabled no/yes
Like:
(To disable)
DSQuery user "OU=SALES,DC=TRAINING,DC=C OM" -name * -Limit 0 |DSMod user -disabled yes
(To enable)
DSQuery user "OU=SALES,DC=TRAINING,DC=C OM" -name * -Limit 0 |DSMod user -disabled no
DSQuery user "Distinguished Name" -name * -Limit 0 |DSMod user -disabled no/yes
Like:
(To disable)
DSQuery user "OU=SALES,DC=TRAINING,DC=C
(To enable)
DSQuery user "OU=SALES,DC=TRAINING,DC=C
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and to enable them
dsquery user ou=NameOfOU,dc=Mydomain,dc