The Keeper
Senior member
I hope we have plenty of people around here who knows their AD scripting. 🙂
Well anyway. I have pretty simple bat file that disables user accounts.
I'd like to expand that bat file to do more. As it already writes a txt file where there are distinguished names of all groups the user is part of, I'd like to expand on that by removing the user from these groups. But even after an hour of googling, I couldn't figure it out right.
Anybody here who could lend a hand?
Well anyway. I have pretty simple bat file that disables user accounts.
@ECHO OFF
Set INPUT=
SET /P INPUT=Type username: %=%
dsquery user -samid %input% | dsget user -memberof > c:\disabled_userst\%input%.txt
dsquery user -samid %input% | dsmod user -disabled yes
dsquery user -samid %input% | dsmove -newparent ou="Disabled Users"dc=company,dc=com
I'd like to expand that bat file to do more. As it already writes a txt file where there are distinguished names of all groups the user is part of, I'd like to expand on that by removing the user from these groups. But even after an hour of googling, I couldn't figure it out right.
Anybody here who could lend a hand?