Link to home
Start Free TrialLog in
Avatar of mgmohiuddin
mgmohiuddin

asked on

need a script to check for stale computer accounts, disable them and move them to a specific ou

i have a lot of computers in my active directory which have been removed from the network but their computer accounts are still there. our organization is very scattered and i am told not to delete any record till i verify it properly. i found a few scripts which could do it form me in a minute but i want to do it in a controlled manner. if legitimate computers are deleted our user support guys are going to run around joining the computers to the domain and our locations are scattered. i need a script using which i want to create a list of around 50 computers a day which have not logged on for more than 90 days , disable them instead of deleting them and move them to s specific OU. once i move them i will retain them in this desabled state for one month more before i delete the accounts. appreciate if someone can help me develop a script of identifying 50 to 100 computers a day which are stale, disabling them and moving them to a specific ou
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RobSampson
I think OldComp, or oldcmp.exe, can help here....
http://www.joeware.net/freetools/tools/oldcmp/index.htm

Regards,

Rob.
Avatar of mgmohiuddin
mgmohiuddin

ASKER

thanks for the reply
 i have seen the links and are leally good. my problem is i can either use dsquery or oldcmp.exe to generate a list. then from the list i just want to take 50 computers a day, make a seperate file containing those 50 computers. then somehow use the file containing the 50 accounts to ping the to make sure they are inactive. if there are active computers which i dont think is a possibility, but just as an additional check, remove them from the list. and make a final file. then i want to disable the computers in the list and move them to an OU. keep them there in the disabled state for around 30 days and then delete them. just want to be safe sir. now the next time i run the file either dsquery or oldcmp, the disabled computers should not be part of the list as i have already disabled them, which ultimately will be deleted.  appreciate if you could help me with the commands and switches in the form of scripts

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yow, no points for all of Rob's extra effort?  That's pretty harsh.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i am so embarassed. i wanted to click on accept solution on the button below rob and i think i pressed it at the wrong place. i will write to the concerned people to reassign the points. extremely sorry for this and will write to them right away
LOL!  Much appreciated!  Thanks.

Rob.
Hy @all,

but thats no guarante to find inactive comp accounts or am I wrong ? I tried this in our environment and find about 800 "old computers" but if I have a closer look, there are a lot of active clients. What switch can be used similar to "dsquery computer -inactive 13 ...." with oldcmp.exe ? In my case I get the better result with dsquery, but it isn´t that sexy like your script. :-)

Thanks
Wbr
Tom