Using the Nltest.exe utility from the Support Tools on the operating system CD-ROM, I have scripted UserExists.bat
to determine if a user account is defined in a remote computers SAM (Security Accounts Manager)
database.
The syntax for using UserExists.bat is:
call UserExists Computer User YorN
Where:
Computer is the NetBIOS computer name of the remote computer. User is the user logon name on the remote computer. YorN is a call directed environment variable that will contain a Y if the user exists, or an N if the user does NOT exist.UserExists.bat contains:
@echo off if \{%3\}==\{\} @echo Syntax: call UserExists Computer User YorN&goto :EOF set %3=N for /f "Tokens=*" %%a in ('nltest /Server:%1 /User:%2^|Find "User:"') do ( set %3=Y )
0 comments
Hide comments