When you type username /?, you receive:
Switches: (designated by - or /)
-t text Text to write in front of value (not valid with -f).
-f file Writes a file with cmd/bat file format with major formats.
Variables possibly defined
UN-DN Fully Qualified DN
UN-SAM SAM Name
UN-Display Display Name
UN-UniqueID Unique ID
UN-Canonical Canonical Name
UN-UPN User Principal Name
-format x Format to write value in:
1 Fully Qualified DN
2 SAM Name
3 Display Name
6 Unique ID
7 Canonical Name
8 User Principal Name
9 Canonical Name Extended (2 line output)
10 Service Principal Name
Write the output to a cmd or bat file and then CALL the file and it
will load the environment variables into the environment namespace.
Displays current user's SAM Account Name
username -format 1
Displays current user's Full Qualified DN
username -format 1 -t "set u="
Displays current user's FQ DN as set u=<fqdn>
username -f vars.cmd
Dumps all values it can to vars.cmd in set xxx= format
This software is Freeware. Use it as you wish at your own risk.
If you have improvement ideas, bugs, or just wish to say Hi, I
receive email 24x7 and read it in a semi-regular timeframe.
You can usually find me at firstname.lastname@example.org</fqdn>