cdtech9198
IS-IT--Management
Hello I am working on a script to change default smtp address for a group of users in a ou. I can not do it with exchange using recipient policy. Once I get the default email hopefully I can store everything to the left of the @ sign and amend @newdomain.com
Right now I am just trying to query AD to display the mail address but having trouble. Its been a while since I touched vbscript
Thank you.
Right now I am just trying to query AD to display the mail address but having trouble. Its been a while since I touched vbscript
Code:
Set objShell = WScript.CreateObject("WScript.Shell")
Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
OUPath = "LDAP://OU=test,DC=foo,DC=com"
Set CNUsers = GetObject (OUPath)
CNUsers.Filter = Array("user")
For Each User in CNUsers
address = User.mail
wscript.echo address
Next