I have scripted DnUsrCpr.bat to return the distinguished name of the logged on user and their computer, using standard commands.

The syntax for using DnUsrCpr.bat is:

DnUsrCpr UserDN CompDN

Where:

UserDN is a call directed environment variable that will contain the logged on user distinguished name.                              CompDN is a call directed environment variable that will contain the DN of the computer they are logged on from.

Example:

When I use DnUsrCpr UserDN CompDN, UserDN is set to "CN=Jerold Schulman,CN=Users,DC=JSIINC,DC=COM" and CompDN is set to "CN=JSI009,CN=Computers,DC=JSIINC,DC=COM".

DnUsrCpr.bat contains:

                              @echo off                              if \{%2\}==\{\} @echo Syntax Call DnUsrCpr UserDN ComputerDN&exit /b 1                              if exist "%TEMP%\DnUsrCpr.vbs" goto doit                              @echo Set objSysInfo = CreateObject("ADSystemInfo")>"%TEMP%\DnUsrCpr.vbs"                              @echo Wscript.Echo objSysInfo.UserName ^& ";" ^& objSysInfo.ComputerName>>"%TEMP%\DnUsrCpr.vbs"                              :doit                              for /f "Tokens=1* Delims=;" %%c in ('cscript //Nologo "%TEMP%\DnUsrCpr.vbs"') do (                               set %1="%%c"                               set %2="%%d"                              )                              exit /b 0