From 9768b0e57daa9d0e43e6b783a0c675027d4318b6 Mon Sep 17 00:00:00 2001 From: AdminDroid <49208841+admindroid-community@users.noreply.github.com> Date: Thu, 7 Jan 2021 12:54:56 +0530 Subject: [PATCH] Configure Plus Addressing in Exchane Online Configure Plus Addressing in Exchane Online --- .../PlusAddressingConfiguration.ps1 | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Plus Addressing Configuration/PlusAddressingConfiguration.ps1 diff --git a/Plus Addressing Configuration/PlusAddressingConfiguration.ps1 b/Plus Addressing Configuration/PlusAddressingConfiguration.ps1 new file mode 100644 index 0000000..2d1e881 --- /dev/null +++ b/Plus Addressing Configuration/PlusAddressingConfiguration.ps1 @@ -0,0 +1,62 @@ +Param +( + [Parameter(Mandatory = $false)] + [switch]$CheckStatus, + [switch]$Enable, + [switch]$Disable +) +#Check for EXO v2 module inatallation + $Module = Get-Module ExchangeOnlineManagement -ListAvailable + if($Module.count -eq 0) + { + Write-Host Exchange Online PowerShell V2 module is not available -ForegroundColor yellow + $Confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No + if($Confirm -match "[yY]") + { + Write-host "Installing Exchange Online PowerShell module" + Install-Module ExchangeOnlineManagement -Repository PSGallery -AllowClobber -Force + } + else + { + Write-Host EXO V2 module is required to connect Exchange Online.Please install module using Install-Module ExchangeOnlineManagement cmdlet. + Exit + } + } + + #Connect Exchange Online + Write-Host Connecting to Exchange Online... -ForegroundColor Cyan + Connect-ExchangeOnline + + #Check for Plus Addressing status + if($CheckStatus.IsPresent) + { + $Status=Get-OrganizationConfig | select AllowPlusAddressInRecipients + if($Status -eq $true) + { + Write-Host Currently, Plus Addressing is enabled in your organization. + } + else + { + Write-Host Currently,Plus Addressing is disabled in your organization. + } + } + + #Enable Plus Addressing + if($Enable.IsPresent) + { + Set-OrganizationConfig –AllowPlusAddressInRecipients $True + if($?) + { + Write-Host Plus addressing enabled successfully -ForegroundColor Yellow + } + } + + #Disable Plus Addressing + if($Disable.IsPresent) + { + Set-OrganizationConfig –AllowPlusAddressInRecipients $False + if($?) + { + Write-Host Plus addressing disabled successfully -ForegroundColor Yellow + } + } \ No newline at end of file