I have to clean up computer objects in our AD, and as all computernames has the username included (like pcuser1, nbuser2 and so on), I'm trying to figure out how to generate a complete AD userlist and then compare it to a complete computername list. Our user objects are consistent so this comparison would tell me, if a computer object does not compare to a user.
How should I proceed with this? I'm no pro at scripting but I assume some vbs or powershell could do the trick. It's the comparing part I'm not to keen on.
Some pseudo code could be:
get all usernames from AD > text1 get all computernames from AD > text2 traverse text1 traverse text2 if text1.line# is contained in text2.line# then text1.line# and text2.line# > output.txt