JSI Tip 10306. How can I set all local computer descriptions equal to the Active Directory computer descriptions?

Jerold Schulman

March 22, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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

DomDesc.bat contains:

@echo offsetlocal EnableDelayedExpansionset dsq=dsquery * domainroot -filter "(&(objectCategory=Computer))" -attr Name Description -limit 0set key=HKLMSYSTEMCurrentControlSetServiceslanmanserverparametersfor /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



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like