0 votes

Trying to set the primary proxy when doing a name change on an email address.

by (1.0k points)

1 Answer

–1 vote
by (294k points)

Hello,

There is no need to use scripts. It can be done using a business rule triggering After renaming a user and built-in action, Modify Exchange properties. The following tutorial will be helpful: https://www.adaxes.com/help/AutomateExchangeMailboxConfiguration.

0

We don't let addaxes update Azure like that. We set the settings in AD and let the oneway sync update Azure. Also, I need to remove any spaces in the the email address due to a user having a space in their name like Del Rio for example. Is there a way to set up a buisiness rule to remove spaces from an email address or proxy when I set it?

0

Hello,

We don't let addaxes update Azure like that.

Adaxes is aware of the way hybrid Exchange works. The action works accordignly.

I need to remove any spaces in the the email address due to a user having a space in their name like Del Rio for example.

In this case, it is easier to directly do the whole thing in a script like below. It will take the required template, remove spaces and add it as new address. In the script:

  • $newAddressTemplate - Specifies the template for the address to add. You can use value references in the template. They will resolve into the corresponding property values of the target object.
  • $setAsPrimary - Specifies whether to set the new address as primary.
$newAddressTemplate = "%firstname%%lastname%@example.com" # TODO: modify me
$setAsPrimary = $True

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Automatically update e-mail addresses based on e-mail address policy
$mailboxParams.EmailAddressPolicyEnabled = $false

$emailAddresses = $mailboxParams.EmailAddresses
$emailAddresses.OverrideOldValues = $false

# Create a new e-mail address
$emailAddress = $emailAddresses.CreateAddress("ADM_EXCHANGE_ADDRTYPE_SMTP", $null)
$emailAddress.Address = $newAddressTemplate.Replace(" ","")
$emailAddress.IsPrimary = $setAsPrimary

# Add the new e-mail address to the existing list
$emailAddresses.Add("ADS_PROPERTY_APPEND", $emailAddress)
$mailboxParams.EmailAddresses = $emailAddresses

# Save changes
$user = $Context.BindToObjectByDNEx("%distinguishedName%", $true)
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")

Related questions

0 votes
1 answer

I don't understand how you would use this searcher function. Can you show me in this example? Import-Module ImportExcel #set up variables $currentTime = Get-Date ... $Context.BindToObjectByDN($NewU) $U.Put("adm-CustomAttributeBoolean6", $False) $U.SetInfo() }

asked Dec 14, 2023 by mightycabal (1.0k points)
0 votes
1 answer

I am trying to use a script to set a users AccountExpires attribute. However, I want there to be an approval sent and I am ... = $False $Context.SubmitForApproval($approvers, $managerOfRequestorIsApprover, $false, $false, $false) }

asked Dec 1, 2023 by mightycabal (1.0k points)
0 votes
1 answer

The rule runs but since the first name and last name are passed as parameters, I only get the sequential # as a userID without the initials.

asked Oct 24 by curtisa (290 points)
0 votes
1 answer

Thanks for the info. I'm now grabbing the %adm-ManagerUserName% value, but need to remove the final 21 characters of it so it contains only their username and not our ... this in the PowerShell Script Editor for my business rule, I get the following error:

asked Mar 11, 2021 by mkvidera (60 points)
3,588 questions
3,277 answers
8,303 comments
548,090 users