This script is to change email addresses of user accounts, perhaps you can alter it for contacts:
On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
strUserF = "(&(objectClass=user)(mail=*))"
strUserA = "distinguishedName,sAMAccountName"
strUserQ = "<LDAP://DC=mydomain,DC==com>;" & strUserF & ";" & strUserA & ";subtree"
objCommand.CommandText = strUserQ
Set objRecordSet = objCommand.Execute
If ( objRecordSet.RecordCount <> 0 ) Then
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strUserDN = objRecordSet.Fields("distinguishedName").Value
Set objUser = GetObject("LDAP://" & strUserDN)
strMail = objUser.mail
If ( InStr(strMail, "@olddomain.com") <> 0 ) Then
Set objRecip = objUser
sAddress = "SMTP:" & Replace(objUser.mail, "olddomain.com", "newdomain.co.za")
vProxyAddresses = objRecip.ProxyAddresses
nProxyAddresses = UBound(vProxyAddresses)
i = 0
Do While i <= nProxyAddresses
email = vProxyAddresses(i)
If ( InStr(email, "olddomain.com") > 0 ) Then
vProxyAddresses(i) = ""
End If
If ( InStr(email, "newdomain.co.za") > 0 ) Then
vProxyAddresses(i) = "SMTP:" & Mid(email, 6)
Exit Do
End If
i = i + 1
Loop
objRecip.ProxyAddresses = vProxyAddresses
objUser.Put "mail", Right(sAddress, Len(sAddress) - 5)
objUser.SetInfo
End If
objRecordSet.MoveNext
Loop
Else
Set objRecordSet = Nothing
Set objConnection = Nothing
WScript.Echo "No users found with the email address @olddomain.com"
WScript.Quit
End If
Set objRecordSet = Nothing
Set objConnection = Nothing
WScript.Echo "Done"
WScript.Quit