I have scripted uDN.bat to retrieve the distinguishedName of the logged on user.
The syntax for using uDN.bat is:
call uDN DN
Where DN is a call directed environment variable that will contain the logged on user's distinguishedName, like "CN=Jerold Schulman,CN=Users,DC=JSIINC,DC=COM".
uDN.bat contains:
@echo off if \{%1\}==\{\} @echo Syntax: uDN DN&goto :EOF if exist "%TEMP%\uDN.VBS" goto getDN @echo.Set objSysInfo = CreateObject("ADSystemInfo")>"%TEMP%\uDN.VBS" @echo.sUser =">>"%TEMP%\uDN.VBS" @echo.WScript.Echo sUser>>"%TEMP%\uDN.VBS" :getDN for /f "Tokens=*" %%u in ('cscript //nologo "%TEMP%\uDN.VBS"') do ( set %1=%%u )" ^& objSysInfo.UserName ^&
0 comments
Hide comments