-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Convert-LegacyExchangeDN to X500
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
Microsoft Exchange Server/Convert-LegacyExchangeDN to X500/ConvertTo-X500.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<# | ||
.SYNOPSIS | ||
Powershell Script for converting Exchange Legacy DN to X500 Address. | ||
.DESCRIPTION | ||
When you send email messages to an internal user in Microsoft 365 you can receive a IMCEAEX-NDR. This issue occurs because the | ||
value for the LegacyExchangeDN attribute changed. The auto-complete cache in Outlook and/or OWA route the mail messages internally. | ||
If this route is no longer exists you can receive this error. | ||
To solve this, convert the LegacyExchangeDN to an X500-address and add this address as an alias to the users mailbox. | ||
.EXAMPLE | ||
ConvertTo-X500 -LegacyDN "IMCEAEX-_O=MMS_OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+20+28FYDIBOHF23SPDLT+29_CN=RECIPIENTS_CN=User6ed4e168-addd-4b03-95f5-b9c9a421957358d@mgd.domain.com" | ||
.NOTES | ||
Created by : T13nn3s | ||
Version : 1.1.0 (1 september 2018) | ||
Changelog: | ||
v.1.1.0 (1 september 2018) | ||
- Adding pipeline support | ||
- Parameter 'LegacyDN' supports now a array input | ||
- Write the output back to the pipeline | ||
v1.0 (19 april 2018) | ||
- Initial script creation. | ||
.LINK | ||
More information about IMCEAEX-NDR: https://support.microsoft.com/en-us/help/2807779/ | ||
#> | ||
|
||
function ConvertTo-X500 { | ||
[CmdletBinding()] | ||
param ( | ||
# Specify LegacyExchangeDN | ||
[Parameter( | ||
Mandatory = $True, | ||
HelpMessage = "Specify Legacy DN wich needs to converted to X500.", | ||
ValueFromPipeline = $True, | ||
ValueFromPipelinebyPropertyName = $True | ||
)][alias("DN", "LD", "Legacy")] | ||
[string[]] | ||
$LegacyDN | ||
) # End param | ||
|
||
foreach ($X500 in $LegacyDN) { | ||
# Convert From Legacy DN to X500 | ||
$X500 = $X500.Replace("_", "/") | ||
$X500 = $X500.Replace("+20", " ") | ||
$X500 = $X500.Replace("IMCEAEX-", "") | ||
$X500 = $X500.Replace("+28", "(") | ||
$X500 = $X500.Replace("+29", ")") | ||
$X500 = $X500.Replace("2E", ".") | ||
$X500 = $X500.Replace("5F", "_") | ||
$x500 = $x500.Split("@")[0] | ||
} | ||
# Return value to pipeline | ||
New-Object PSObject -Property @{ | ||
X500 = "X500:" + $x500 | ||
} | ||
} # End function |
28 changes: 28 additions & 0 deletions
28
Microsoft Exchange Server/Convert-LegacyExchangeDN to X500/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Convert-LegacyExchangeDN-to-X500 | ||
When you send email messages to an internal user in Microsoft 365 you can receive an IMCEAEX-NDR. This issue occurs because the value for the LegacyExchangeDN attribute changed. The auto-complete cache in Outlook and/or OWA route the mail messages internally. If this route is no longer exists you can receive this error. | ||
To solve this problem, convert the LegacyExchangeDN to an X500-address and add this address as an alias to the user's mailbox in ECP. | ||
|
||
# How to use | ||
First, you need to load this function into your active Powershell console. | ||
```powershell | ||
Import-Module ConvertTo-X500 | ||
``` | ||
Call the function ConvertTo-X500 | ||
```powershell | ||
ConvertTo-X500 -LegacyDN "IMCEAEX-_O=MMS_OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+20+28FYDIBOHF23SPDLT+29_CN=RECIPIENTS_CN=User6ed4e168-addd-4b03-95f5-b9c9a421957358d@mgd.domain.com" | ||
``` | ||
|
||
# Changelog | ||
|
||
## [1.1.0] 1 september 2018 | ||
|
||
### Added | ||
- Adding pipeline support | ||
- Parameter 'LegacyDN' supports now a array input | ||
- Write the output back to the pipeline | ||
|
||
## [1.0] 19 april 2018 | ||
- Initial script creation. | ||
|
||
|
||
|