Created
August 6, 2015 15:23
-
-
Save jangeador/860d7187080dbe0bbc93 to your computer and use it in GitHub Desktop.
Move all stale active directory accounts to a new OU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Move all stale computer accounts (not active in 26 weeks) to the designated OU | |
for /f "Tokens=*" %s in ('DSQUERY computer "ou=GESD32,dc=GESD32,dc=AZ,dc=US" -inactive 26 -limit 0') do DSMOVE %s -newparent "ou=Computers,ou=Stale_Accounts,DC=GESD32,DC=AZ,DC=US" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment