Jump to content

Recommended Posts

Posted

I'm trying to work out a PowerShell script to run the following command on all users in an individual OU, where $username and $mailalias are the same (e.g. the users logon account to the domain). My PowerShell skills are a bit flaky, so I'm just not sure how to construct this. Can anyone help?

 

Enable-RemoteMailbox -identity $username -RemoteRoutingAddress [email protected]

Posted

We used this for the exact same task:

 

Get-user -organizationalUnit “your.domain.here/path/to/user/ou” | where-object{$_.RecipientType -eq “User”}  | foreach {Enable-RemoteMailbox -identity $_.userprincipalname -RemoteRoutingAddress ($_.samaccountname+’@yourmstenantname.mail.onmicrosoft.com’)}

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...