Can someone tell me how to return the OU a computer is in using batch? When someone logs on to their computer, I want a logon script to run that can determine what OU the computer is. I assume I could run a command that searches Active Directory and pass it %computername%, but I'm not sure how. Also, the OU should be set to a variable like %ou% or something.
Thanks in advance.