KEMBAR78
Exchange 2013 Hybrid PowerShell Guide | PDF | Office 365 | Active Directory
0% found this document useful (0 votes)
255 views2 pages

Exchange 2013 Hybrid PowerShell Guide

The following PowerShell commands have been used in an Exchange 2013 Hybrid – Exchange Online environment, where the authoritative identity remains on premise with Active Directory. This should be used as a starter while different business scenarios may require different attribute filtering or different options chosen to be configured. Below some commands are run from on premise Exchange PowerShell and others are run from a PowerShell connected to MSOL Service.

Uploaded by

Nathan Swift
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
255 views2 pages

Exchange 2013 Hybrid PowerShell Guide

The following PowerShell commands have been used in an Exchange 2013 Hybrid – Exchange Online environment, where the authoritative identity remains on premise with Active Directory. This should be used as a starter while different business scenarios may require different attribute filtering or different options chosen to be configured. Below some commands are run from on premise Exchange PowerShell and others are run from a PowerShell connected to MSOL Service.

Uploaded by

Nathan Swift
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Common Exchange 2013 Hybrid \ Office 365 PowerShell

Uses

The following PowerShell commands have been used in an Exchange 2013 Hybrid Exchange
Online environment, where the authoritative identity remains on premise with Active Directory.
This should be used as a starter while different business scenarios may require different
attribute filtering or different options chosen to be configured. Below some commands are run
from on premise Exchange PowerShell and others are run from a PowerShell connected to
MSOL Service.

Lets get connected Exchange Online

Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential
$O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session

Lets get connected Office 365

Connect-MsolService Credential $O365Cred

Lets get the Office 365 licenses for an individual user (PowerShell Connected to MSOL Service)
(Get-MSOLUser UserPrincipalName upnname@domain.com).Licenses[0].ServiceStatus
Lets get the Office 365 licenses for our organization (PowerShell Connected to MSOL Service)
get-msoluser -all | ForEach-Object { "============="; $_.DisplayName; $_.Country; $_.licenses[0].servicestatus}

Lets bulk enable remote mailboxes and set with archive (On Premise Exchange PowerShell)

Get-user organizationalUnit domain.com/Asia Pacific/Vietnam/Users| where-object {$_.RecipientType eq User} | foreach {Enable-
RemoteMailbox -identity $_.userprincipalname -primarysmtpaddress ($_.firstname+'.'+$_.lastname+@primarysmtpaddress.com) -
RemoteRoutingAddress ($_.samaccountname+@domain.mail.onmicrosoft.com)} | set-remotemailbox -emailaddresspolicyenabled:$true


Get-user organizationalUnit domain.com/Asia Pacific/Vietnam/Users| where-object{$_.RecipientType eq User} | foreach {Set-
RemoteMailbox -identity $_.userprincipalname -archive}


Using a filter to prevent some accounts from receiving a remote mailbox while setting in bulk
(On Premise Exchange PowerShell)

Retrieve List of No MBX users

Get-user organizationalUnit domain.com/Europe/Austria/Users| where-object {$_.RecipientType eq User} | where { $_.notes -like "*No
MBX*" }

Enable Remote Mailbox and Archive

Get-user organizationalUnit domain.com/Europe/Austria/Users| where-object {$_.RecipientType eq User} | where { $_.notes -notlike
"*No MBX*" } | foreach {Enable-RemoteMailbox -identity $_.userprincipalname -primarysmtpaddress
($_.firstname+'.'+$_.lastname+@primarysmtpaddress.com) -RemoteRoutingAddress
($_.samaccountname+@domain.mail.onmicrosoft.com)} | set-remotemailbox -emailaddresspolicyenabled:$true

Get-user organizationalUnit domain.com/Asia Pacific/Vietnam/Users| where-object{$_.RecipientType eq User} | where { $_.notes -
notlike "*No MBX*" } | foreach {Set-RemoteMailbox -identity $_.userprincipalname -archive}

Lets set usage location, assign licenses, and set mailbox language to Office 365 users in bulk
(PowerShell Connected to MSOL Service)

Get-msoluser -maxresults 40000 | where-object{$_.Country eq Vietnam} | foreach {Set-MsolUser -UserPrincipalName
$_.UserPrincipalName -UsageLocation "VN"}


Get-msoluser -maxresults 40000 | where-object{$_.Country eq Vietnam} | foreach {Set-MsolUserLicense -UserPrincipalName
$_.UserPrincipalName -AddLicenses 'domain:ENTERPRISEPACK'}

Get-msoluser -maxresults 40000 | where-object{$_.Country eq Germany} | foreach {set-MailboxRegionalConfiguration -Identity
$_.UserPrincipalName -Language de-de -DateFormat "dd.MM.yyyy" -TimeFormat HH:mm -LocalizeDefaultFolderName:$True}
Lets get the Encryption Configuration (PowerShell Connected to Exchange Online Service)

Get-OMEConfiguration

You might also like