Creating a Mail Forwarding Contact in AD
Greetings,
I'm looking to create a contact object in the AD using a vbscript. This contact will have a forward SMTP email address. This is what I have so far:
Set objOU = GetObject("LDAP://" & strTargetOU)
Set objContact = objOU.Create("contact", "cn=joejack")
objContact.Put "GivenName", "Joe"
objContact.Put "SN", "Jackass"
objContact.Put "Description", "Test Contact"
objUser.SetInfo
The question I have is how I can create/add the exchange attributes for the target SMTP address and how to check/uncheck the attribute that makes sure that the contact object doesn't appear in the GAL.
Any help would be greatly appreciated. Thanks.
[704 byte] By [
Exxon_Beta] at [2007-11-19 9:13:31]

# 1 Re: Creating a Mail Forwarding Contact in AD
Try this...
' Contact .vbs
' Purpose VBScript to create a contact object in Active Directory
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.3 - May 2005
' -------------------'
Option Explicit
Dim objRoot, objOU, objDomain, objContact, strYourDescription
Dim strDNS, strContainer, strContactName, strEmail
' Set string variables
strContainer = "OU=Suppliers"
strContactName = "cn=MySupplier1"
strEmail = "supplier@supplyme.com"
strYourDescription = "Guy's Contact"
' Section to attach to Active Directory
Set objRoot = GetObject("LDAP://rootDSE")
strDNS = objRoot.Get("defaultNamingContext")
Set objDomain = GetObject("LDAP://" & strDNS)
' Section to create the contact
Set objOU = GetObject("LDAP://"& strContainer & "," & strDNS)
Set objContact = objOU.Create("contact", strContactName)
objContact.Put "Description", strYourDescription
objContact.Put "Mail", strEmail
objContact.Put "internetEncoding",1310720
objContact.SetInfo
Wscript.Echo "Look in " & strContainer & " for (F5) " & strEmail
' End of Sample Contact VBScript