set-QADUser Question Help

Anybody know how to use Replace with set-QADUser?

Trying to switch email suffix on users through a workflow. 

$workflow.ActivityTarget("CreateDev511Account") is the name of the activity target. The workflow creates a user earlier with the old email suffix copied from other domain, but then this script further down the workflow would fix the suffix while keeping the name prior to the @.

Example myname@oldEmail.com to myname@NewEmail.com.

Something like this.

Set-QADUser $workflow.ActivityTarget("CreateDev511Account").get("distinguishedName") -email replace('@oldEmail.com', '@NewEmail.com')

I am not doing the Replace correctly and it is not working for me...

Parents
  • What property are you actually trying to change?

    Are these users mail or mailbox enabled?

    "Normally", you would change the primary e-mail address by manipulating the proxyaddresses property - i.e. by setting a new Primary SMTP address.

    Also, are you trying to use a Search Activity to find the users?

    Need a bit more detail on what you are trying to accomplish and your current approach.

  • Figured it out. This is what I did.

    function UpdateMail($Request)

    {
    $UserDN = Get-QADUser $workflow.ActivityTarget("CreateDevAccount").get("distinguishedName")
    $UserMailOld = Get-QADUser -Identity $UserDN -Properties * | select mail
    $UserMailNew = $UserDN.mail.Replace('@oldMail.com', '@newMail.com')
    Set-QADUser $UserDN -mail $UserMailNew

    }

Reply Children
No Data