Using DSQuery and DSGet to get user attributes that are needed to make accounts (not associated with their Windows account). The current command I've got is:
dsquery * -filter "(&(objectCategory=Person)(objectclass=User)([email protected]))" | dsget user -samid -fn -ln -office -email > user.txt
which gets me all the information I need except the domain the user is associated with. There's the attribute in AD called User logon name (pre-Windows 2000) (first box), but as far as I can tell DSGet doesn't return that. I know the DSQuery can get me the groups the user is in but I'm not sure if there's an easy (one-liner) that can get the info needed. Any guidance or help is appreciated.
There is no attribute User logon name (pre-Windows 2000) in Attribute Editor so there is another way we can get the user logon name using distinguish name (DN) and UPN(User logon Name)
please use the below command to get the DN
This is for user
This is under Domain Users