The full DNS name my workstation is JSI009.JSIINC.COM and it's Common Name is JSI009.

Using standard commands, I have scripted FullDNSName.bat to retrieve the full DNS name of the current computer.

The syntax for using FullDNSName.bat is:

\[call\] FullDNSName Name

Where Name is a call directed environment variable that will contain the computer's full DNS name.

FullDNSName.bat contains:

                              @echo off                              if \{%1\}==\{\} @echo Syntax: FullDNSName Name&goto :EOF                              if exist "%TEMP%\FullDNSName.vbs" goto doit                              @echo.Set objSysInfo = CreateObject("ADSystemInfo") >"%TEMP%\FullDNSName.vbs"                              @echo.strComputerDN = objSysInfo.ComputerName>>"%TEMP%\FullDNSName.vbs"                              @echo.Set objComputer = GetObject("LDAP://" ^& strComputerDN)>>"%TEMP%\FullDNSName.vbs"                              @echo.Wscript.Echo objComputer.dnsHostName>>"%TEMP%\FullDNSName.vbs"                              :doit                              set %1=Not Found                              for /f "Tokens=*" %%a in ('cscript //nologo "%TEMP%\FullDNSName.vbs"') do (                               set %1=%%a                              )