Skip to content

Instantly share code, notes, and snippets.

@Doug-Moody
Created January 31, 2020 16:36
Show Gist options
  • Save Doug-Moody/9a937eeca20b800347a8150a6ab50260 to your computer and use it in GitHub Desktop.
Save Doug-Moody/9a937eeca20b800347a8150a6ab50260 to your computer and use it in GitHub Desktop.
A CMD Batch file to quickly locate anyone on the domain that has any matching letters in name
@echo off
:START
color 0
setlocal
cls
echo.
set user=
set /p user=Enter First or Last name, or part of a name:
cls
color a
echo Listing all AD accounts with %user% in their name.
echo ############# BELOW ARE ALL USERS NAMES ##############
dsquery user -name "*%user%*"
echo.
echo ############## BELOW ARE AD USER ACCTS ################
DSQUERY USER -name "*%user%*" | DSGET USER -samid -display
echo.
echo.
echo If using LookUp, try combinations of first initial, middle initial
echo lastname like swhinton instead of shinton
echo.
pause
goto :START
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment