Demonstration script that retrieves the location and description attributes for a computer account in Active Directory.
On Error Resume NextSet objComputer = GetObject _("LDAP://CN=atl-dc-01,CN=Computers,DC=fabrikam,DC=com")objProperty = objComputer.Get("Location")If IsNull(objProperty) ThenWscript.Echo "The location has not been set for this computer."ElseWscript.Echo "Location: " & objPropertyobjProperty = NullEnd IfobjProperty = objComputer.Get("Description")If IsNull(objProperty) ThenWscript.Echo "The description has not been set for this computer."ElseWscript.Echo "Description: " & objPropertyobjProperty = NullEnd If
This is a VB Script, this can be used by saving the file in .vbs file