Skip to content

Set Computer Description from Active Directory

We often run audit reports on our clients networks to ascertain age of equipment, but identify where each computer is can be tricky from just the name and potentially the Last Login. We also endeavour to keep the computer description up to date in Active Directory so we know where it as and who uses it, but this isn’t as easy to pick up on an audit, so after a look around the internet I came up with the following script to set the Computer Description from the the Active Directory Computer Description:

Const HKEY_LOCAL_MACHINE = &H80000002

Set objSysInfo = CreateObject(“ADSystemInfo”)

Set objComputer = GetObject(“LDAP://” & objSysInfo.ComputerName)

strDescrip = objComputer.Description

Set objRegistry = GetObject(“winmgmts:\.rootdefault:StdRegProv”)

strKeyPath = “SystemCurrentControlSetServiceslanmanserverparameters”
strValueName = “srvcomment”
strDescription = strDescrip

objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strDescription

Be careful that the description isn’t longer than 48 character or it won’t show when you browse the network as per http://support.microsoft.com/kb/231312/

Back To Top