Decrypt CRM Email Router saved passwords

We are using Email Router for Dynamics CRM 2011. And we have lots of profiles there. During migration to CRM 2015 we need to recreate email server profiles and mailboxes. I don't like how OOB migrate email router data works. Cause it creates email server profile per email router configuration profile. I prefer create one email server profile per email provider (smtp server) and store credentials in mailboxes. It's more convenient. It was a bit time consuming to request email passwords from our clients. So I decided if email router can decrypt passwords, so should I. With this few PowerShell lines you can get passwords for your email profiles:

sl 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\bin>'
Add-Type -Path .\Microsoft.Xrm.Service.dll
Add-Type -Path .\Microsoft.Crm.dll

$enc = New-Object -TypeName Microsoft.Crm.Encryptor -ArgumentList 'C:\Program Files\Microsoft CRM Email\Service\EncryptionKey.xml'

$enc.Decrypt(<EncyptedEmailPassword>)

Replace EncyptedEmailPassword with value between EmailPassword from Microsoft.Crm.Tool.EmailAgent.xml.

Show Comments