Wednesday, October 24, 2018

All in One Office 365 Powershell Connect - Includes Exchange online MFA

I am tempted to update my previously written(2016)  --> All in One Office 365 Powershell Connect as New Shells have arrived and we admins have to work with those.

https://syscloudpro.com/2016/12/18/all-in-one-office-365-powershell-connect/

I am including the support for Exchange Online MFA/Compliance and security MFA by adding below function inside the existing Script.

https://gallery.technet.microsoft.com/scriptcenter/All-in-One-Office-365-77005e37

  • LaunchEOL/RemoveEOL    (Exchange Online)

  • LaunchEOLMFA/RemoveEOLMFA (Exchange Online with MFA)

  • LaunchSOL/RemoveSOL    (Skype online)

  • LaunchSPO/RemoveSPO   (Sharepoint online)

  • LaunchCOL/RemoveCOL    (Security & Compliance)

  • LaunchCOLMFA/RemoveCOLMFA    (Security & Compliance)

  • LaunchMSOL/RemoveMSOL (MSonline Azure activedirectory)


#####################################################################

Function LaunchEOLMFA {

Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}|select -First 1)
$EOLSession = New-ExoPSSession
Import-PSSession $EOLSession -Prefix "EOL" -AllowClobber -Verbose

}

Function RemoveEOLMFA {

$Session = Get-PSSession | where {$_.ComputerName -like "outlook.office365.com"}
Remove-PSSession $Session

}

#############################Compliance Online##################
Function LaunchCOLMFA {

Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}|select -First 1)
$COLSession = New-EXOPSSession -ConnectionUri 'https://ps.compliance.protection.outlook.com/PowerShell-LiveId'
Import-PSSession $COLSession -Prefix "COL" -AllowClobber -Verbose

}

Function RemoveCOLMFA {

$Session = Get-PSSession | where {$_.ComputerName -like "*compliance.protection.outlook.com"}
Remove-PSSession $Session

}

#######################################################################

Note: You need to have Exchange Online MFA Shell (Click here) to make it work.

You can just launch it from your system as below ones you have set it up following the existing All in One Office 365 Powershell Connect blog post.

All commands have prefix added to differentiate it from its onpremise versions which greatly assists hybrid admins scripts and administration.

For example: Get-EOLMailbox instead of Get-mailbox





 

Thanks for reading and downloading

Sukhija Vikas

http://SysCloudPro.com

1 comment: