This was my second script to do this task. The first one would indeed create an Active Directory contact, and forward mail to the contact, but it wasn't an /Exchange/ AD contact, so mail would bounce.
Word to the wise for people like me: AD contacts aren't quite the same as Exchange AD contacts. You'll need the latter if you're going to be sending e-mail to them.
So, what this script does is take input from the command line on what the user's account name is and what their forwarding address should be. Then it creates the contact, and finally, sets that contact as the forwarding address for that person. It mostly comes from here, with some modification:
For us, the OU was forwarding, and you'll want to change the rest of the information to work for your domain.
Option Explicit
Dim objRootLDAP, objContainer, objContact, objExcel, objSheet
Dim strOU, strContactName, strPathExcel, strEmail, strProxy
Dim intRow, strYourDescription, strFirst, strLast, strMainDefault
Dim strMailbox, strNick, SourceUser, ForwardTo, objUser
SourceUser = WScript.Arguments(0) 'The user login name input from command line
ForwardTo = WScript.Arguments(1) 'The contact e-mail input from command line
' Part 1: Set string variables
strOU = "ou=Forwarding ,"
strYourDescription = SourceUser & "'s Contact"
strMainDefault = "SMTP:" & ForwardTo
strContactName= SourceUser & "_Forward"
strFirst = SourceUser
strLast= "Forwarding address"
strProxy = ForwardTo
strEmail = ForwardTo
strMailbox = "/o= ORGANIZATION /ou=Admin Group/cn=Recipients/cn=" & SourceUser & "_forward"
strNick = strContactName
'Part 2: Building the contact
' Section to bind to Active Directory
Set objContainer = GetObject("LDAP://" & strOU & "ou=Contacts,dc=YOURDOMAIN,dc=COM")
' Build the actual contact.
Set objContact = objContainer.Create("Contact",_
"cn=" & strContactName)
objContact.Put "Mail", strEmail
objContact.Put "givenName", strFirst
objContact.Put "sn", strLast
objContact.Put "proxyAddresses", strProxy
objContact.Put "targetAddress", strMainDefault
objContact.Put "legacyExchangeDN", strMailbox
objContact.Put "mailNickname", strNick
objContact.SetInfo
'Part 3: Set the contact as the forward address
Set objUser = GetObject("LDAP://cn=" & SourceUser & ",cn=Users,dc=YOURDOMAIN,dc=COM")
objUser.Put "AltRecipient", "cn="& SourceUser & "_forward,OU=Forwarding,OU=Contacts,DC=YOURDOMAIN,DC=COM"
objUser.SetInfo
WScript.Quit