neonetman Posted June 16, 2021 Posted June 16, 2021 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]
KevinB Posted June 17, 2021 Posted June 17, 2021 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’)} 1
neonetman Posted June 18, 2021 Author Posted June 18, 2021 Thanks @KevinB - that's exactly what I'm after. Just couldn't get my head around the syntax
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now