From the commandline,how can I look up an NT-style name using a distinguished name? That is, I want to put in "CN=Alice Smith,OU=Head Office,DC=Cyberdyne,DC=local" and get out "CYBERDYNE\ASmith"
Edit: Active Directory level 2003, if that matters.
I think you are looking for the sAMAccountname ??
try the following...
dsquery * "CN=Alice Smith,OU=Head Office,DC=Cyberdyne,DC=local" -scope base -attr sAMAccountName
Although that does not get the DOMAIN\ prefix (CYBERDYNE)
Note: I think dsquery is installed on DC's only, you may have to grab a copy from a DC if you want to run it elsewhere...
I missed getting to your question early enough, perhaps, to save you any of that "by hand" labor you mentioned in your comment to Ken Hughes. To do this programmatically you're looking at using the iADsNameTranslate interface. You can get a lot of mileage out of it for dealing translating the various possible names of an AD account (GUID, SID, samAccountName, displayName, DN, etc).