(view source code of getid.bat as plain text)
@ECHO OFF
:: Check Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
VER | FIND "[5.2" >NUL
IF ERRORLEVEL 1 GOTO Syntax
:: Check number of command line arguments
IF "%~1"=="" GOTO Syntax
IF NOT "%~2"=="" GOTO Syntax
:: Check for invalid command line arguments
ECHO.%* 2>&1 | FIND "/" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
ECHO %* 2>&1 | FIND "[" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
:: Display result
ECHO.
DSQUERY User -name "%~1" | DSGET User -display -samid | FIND /V "" | FIND /V "succeeded"
GOTO:EOF
:Syntax
ECHO.
ECHO GetID.bat, Version 1.02 for Windows Server 2003
ECHO Search and display login and full names based on part of a user's full name
ECHO.
ECHO Usage: GETID user_name
ECHO.
ECHO Where: user_name is a user's full name, or part of it with wildcards;
ECHO use quotes if the search string contains spaces.
ECHO.
ECHO Note: May fail on user accounts migrated from Windows NT 4.
ECHO.
ECHO Example: GETID *peter*
ECHO.
ECHO samid display
ECHO WJPET03 Bill Peterson
ECHO PANDR24 Peter Andrews
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
page last modified: 2024-04-16; loaded in 0.0073 seconds