Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bohack/621bebce58318778a5ba07e845b4e7ef to your computer and use it in GitHub Desktop.
Save bohack/621bebce58318778a5ba07e845b4e7ef to your computer and use it in GitHub Desktop.
Get a list of users by their SAMid and lookup their UPN
@ECHO OFF
REM Bohack
REM 2/23/18
REM Get a list of users by their SAMid and lookup their UPN
FOR /F "TOKENS=*" %%a IN (listofusers.txt) DO (
ECHO %%a
DSQUERY USER -SAMID %%a | DSGET USER -SAMID -UPN
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment