Wednesday, October 28, 2009

Sync ADUC and Local Computer Description fields

This is a script to take the description field in Active Directory Users and Computers and place it in the local computer description field. I'm surprised this field doesn't sync automatically. Anyway you could add this to a login or startup script. Or schedule to run every month or so, depend on what your use is. I just wanted the fields to match if the server was retasked (is that a real word?).
 


Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)

'msgbox objComputer.Description 'for testing to view pop up of description field

Set Obj= GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_OperatingSystem")
For Each x In Obj
   x.Description = objComputer.Description
   x.Put_
Next



No comments:

Post a Comment