Hey Experts. I have a script that I use to dump out stale computer accounts from the domain. The script dumps these computer names into a format in the log file that can be used by another script to then move these computer accounts. I want to do the same thing but with user accounts. Here is what I am trying to use in my batch script:
dsquery user OU=Depts,OU=x,DC=x,DC=x,DC=x,DC=x -o rdn -limit 0 -inactive 8 -limit 300 > %logfile%
(for /f "tokens=2,3* delims=,=" %%i in (%logfile%) do @echo %%~i) > c:\tools\staleADPc1-N.log
I'm not getting any useable data so I'm not using the right syntax. I'm fine using Powershell or a batch script but please provide the code as I'm learning as I go here. Any suggestions from the real experts? Thank you!