@ECHO OFF CLS :: FILE: ChkDNS.bat :: :: Lists A-records of the dns domain the user is currently logged into. :: (uses nslookup zone transfer!) :: :: AUTHOR: Parcifal Aertssen :: http://www.aqtronix.com :: Check if working on a UNC path... IF NOT "%CD%"=="%WINDIR%" GOTO start ECHO !!!WARNING!!! ECHO. ECHO You are working in the %WINDIR% directory, this could be because ECHO you are running this script over a network connection and the ECHO path has been redirected (UNC paths are not supported). ECHO For this script to work over a network connection make sure ECHO a drive letter is assigned to the share. This script can work ECHO with the %WINDIR% directory, but it is not advised. ECHO. ECHO Press CTRL-C to abort now or press any key to continue. (You ECHO need to have write permission in the %WINDIR% directory to continue). ECHO. PAUSE :start set chkdomain=%USERDNSDOMAIN% set tmpdnsfile=%TEMP%\chkdnsba.tch IF "%chkdomain%"=="" GOTO end ECHO DNS snapshot of %chkdomain% ECHO. ::check for existing files to prevent errors IF EXIST "%chkdomain%.txt" DEL /q /f "%chkdomain%.txt" IF EXIST "%tmpdnsfile%" DEL /q /f "%tmpdnsfile%" ::start the actual work! ECHO DNS snapshot of %chkdomain% at %DATE% %TIME% >> "%chkdomain%.txt" ECHO. >> "%chkdomain%.txt" ECHO ls %chkdomain% > "%tmpdnsfile%" nslookup < "%tmpdnsfile%" >> "%chkdomain%.txt" ECHO file "%chkdomain%.txt" made. ECHO Opening notepad... CALL notepad "%chkdomain%.txt" ::cleanup :end IF EXIST "%tmpdnsfile%" DEL /q /f "%tmpdnsfile%" SET chkdomain= SET tmpdnsfile= ::PAUSE