Using the Active Directory command-line tools and REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the Windows 2000 Support Tools, I have scripted DomDesc.bat to set all local computer descriptions equal to the Active Directory computer descriptions.

The syntax for using DomDesc.bat is:


DomDesc.bat contains:

                              @echo off                              setlocal EnableDelayedExpansion                              set dsq=dsquery * domainroot -filter "(&(objectCategory=Computer))" -attr Name Description -limit 0                              set key=HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters                              for /f "Skip=1 Tokens=1*" %%a in ('%dsq%') do (                               set domdesc="%%b"                               set domdesc=!domdesc:  =!                               set domdesc=!domdesc: "="!                               set lcldesc=""                               for /f "Tokens=2*" %%x in ('REG Query \\%%a\%key% /V srvcomment^|find "REG_SZ"') do (                                set lcldesc="%%y"                               )                              if !domdesc! NEQ !lcldesc! @Echo %%a !domdesc!                              if !domdesc! NEQ !lcldesc! REG ADD \\%%a\%key% /V srvcomment /T REG_SZ /F /D !domdesc!                              )                              endlocal