Thursday 18 December 2014

Append Description Active Directory VB Script

This is a script to prepend a string to the start of the description to users in active directory. In this case it adds "Nil Usage - " to the start of the description field of the user account details in active directory.

Set OU = GetObject(LDAP://DNSHOSTNAMEOFDC/OU=Test,DC=TESTDOMAIN,DC=co,DC=uk)
For Each oUser In OU
If oUser.Class = "user" Then
oUser.Put "description", "Nil Usage - " & oUser.Description
oUser.SetInfo
End If
Next
Wscript.echo "Test OU has been updated!"
Wscript.Quit

No comments:

Post a Comment