Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 427
  • Last Modified:

Old computer accounts in windows 2008 active directory

I need a script to find and disable computer accounts which are 90 days of no activity in active directory
0
mahmoud_2008
Asked:
mahmoud_2008
  • 3
  • 3
1 Solution
 
helpfinderIT ConsultantCommented:
For finding such a computers use this command:
dsquery computer –inactive 12 > c:\admin\computer90day.txt

and for disable this one should be working
    dsquery computer –inactive 12 | dsmod computer –disabled yes
0
 
mahmoud_2008Author Commented:
Thanks, I checked the first command and it works fine.
for the second command, is it possible to run it against a single OU?
if yes what is the command for that
0
 
helpfinderIT ConsultantCommented:
does not work just select all computers in your desired OU (ctrl+a) and right click where Disable account should be possible?
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
mahmoud_2008Author Commented:
in this case can I move these computers (90 days inactive) to an OU named: disabled_computers, then I can do the above procedure
0
 
helpfinderIT ConsultantCommented:
yes, should be possible.
I found also script on Technet which find inactive computers, disable them and move to separate OU

http://gallery.technet.microsoft.com/scriptcenter/adaf5be6-b266-4263-8d09-cad20ce8d5ef
0
 
mahmoud_2008Author Commented:
Thanks a lot for your help
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now