on error resume next
Set objUser = GetObject("LDAP://CN=" & sAMAccountName & _
"ou=usuarios,dc=quahog,dc=edu,dc=br")
do while objUser = true
objUser.Put "objUser.otherMailbox", "objUser.mail"
objUser.Put "objUser.mail", "objUser.userPrincipalName"
loop
wscript.echo "Done"
I am trying to swap some attributes in my Active Directory: I want my actual e-mail attribute, which happens to be mail
, to be my otherMailbox
. Then, I want my actual logon user name, which I believe to be objUser.userPrincipalName
, to be also my new e-mail.
The code above works perfectly, but if I change CN to sAMAccountName I get this error: I got this error: