Enable DKIM by using Powershell in Exchange Server or IIS SMTP Service

After you installed EA DKIM Plugin on your server, a PowerShell module is provided as well. You can use this module to create/edit/enable/disable/remove DKIM directly in PowerShell instead of using DKIM manager.

Start DKIM Management Shell

You can open “DKIM Management Shell” from Windows Start menu -> All Programs -> EA DKIM for IIS SMTP and Exchange Server. Or you can start it from C:\Program Files (x86)\EAExchDomainKeys\StartDkimShell.cmd.

DKIM in IIS SMTP

Now you can use the following cmdlets to manage DKIM for your domains.

New-DkimDomain

The New-DkimDomain cmdlet creates a new domain in Dkim Manager.

SYNTAX
    New-DkimDomain [-Name] <String> [[-Selector] <String>] [[-PrivateKey] <String>]
    [[-Use1024Key] <Boolean>] [[-IsActive] <Boolean>] [<CommonParameters>]
# New-DkimDomain examples

New-DkimDomain "emailarchitect.net"
# This command creates a new domain named "emailarchitect.net" with default selector "s1024".

New-DkimDomain "emailarchitect.net" -Selector "selector1"
# This command creates a new domain named "emailarchitect.net" with selector 'selector1'.

New-DkimDomain "emailarchitect.net" -Selector "s1024" -PrivateKey (Import-DkimPrivateKey "c:\myfolder\privatekey.pem")
# This command creates a new domain named "emailarchitect.net" with selector 's1024', and it uses the private key imported from privatekey.pem.

New-DkimDomain "emailarchitect.net" -Use1024Key $false
# This command creates domain "emailarchitect.net" with 2048 private key.

help New-DkimDomain -detailed
# This command gets detailed parameters information.

Set-DkimDomain

The Set-DkimDomain cmdlet sets DKIM properties of specified domain in Dkim Manager.

SYNTAX
    Set-DkimDomain [-Name] <String> [[-Selector] <String>] [[-PrivateKey] <String>]
    [[-IsActive] <Boolean>] [[-CanonAlgorithm] <Int32>] [[-RsaHashAlgorithm] <Int32>]
    [[-IsSignPartOfMessage] <Boolean>] [[-IsSignDeliveryReport] <Boolean>]
    [[-IsSignPartOfDeliveryReport] <Boolean>] [[-IsSignSystemMessage] <Boolean>]
    [[-IsSignMapiMessage] <Boolean>] [[-IsRemoveExistedSignature] <Boolean>] [<CommonParameters>]
# Set-DkimDomain examples

Set-DkimDomain "emailarchitect.net" -IsActive $false
# This command changes "IsActive" property value to $false

Set-DkimDomain "emailarchitect.net" -CanonAlgorithm 0
# This command changes "CanonAlgorithm" property value to simple. 0: relaxed; 1: simple

Set-DkimDomain "emailarchitect.net" -RsaHashAlgorithm 1
# This command changes "RsaHashAlgorithm" property value to rsa-sha256. 0: rsa-sha1; 1: rsa-sha256;

Set-DkimDomain "emailarchitect.net" -IsSignPartOfMessage $true
# This command changes "IsSignPartOfMessage" property value to $true

Set-DkimDomain "emailarchitect.net" -PrivateKey (New-DkimPrivateKey)
# This command set a new private key generated by New-DkimPrivateKey.

Set-DkimDomain "emailarchitect.net" -PrivateKey (Import-DkimPrivateKey "c:\myfolder\privatekey.pem")
# This command set a new private key imported from privatekey.pem.

help Set-DkimDomain -detailed
# This command gets detailed parameters information.

Get-DkimDomain

The Get-DkimDomain cmdlet queries domain(s) from Dkim Manager based on the domain name, wildcard is supported in domain name. It returns a domain(s) objects array.

SYNTAX
    Get-DkimDomain [[-Name] <String>] [<CommonParameters>]
# Get-DkimDomain examples

Get-DkimDomain "*" | Format-Table -Property Name,Selector,IsActive -AutoSize -Wrap
# This command queries all domains and outputs domain objects array in table format.

Get-DkimDomain "emailarchitect.net"
# This command queries domain "emailarchitect.net" and outputs domain object.

Get-DkimDomain "email*"
# This command queries domains that match "email*" and outputs domain objects array.

help Get-DkimDomain -detailed
# This command gets detailed parameters information.

Enable-DkimDomain

The Enable-DkimDomain cmdlet set Domain.IsActive property to $true based on the domain name, wildcard is supported in Name.

SYNTAX
    Enable-DkimDomain [[-Name] <String>] [<CommonParameters>]
# Enable-DkimDomain examples

Enable-DkimDomain
# This command enables all domains.

Enable-DkimDomain "emailarchitect.net"
# This command enables domain "emailarchitect.net".

Enable-DkimDomain "email*"
# This command enables domains that match "email*".

help Enable-DkimDomain -detailed
# This command gets detailed parameters information.

Disable-DkimDomain

The Disable-DkimDomain cmdlet set Domain.IsActive property to $false based on the domain name, wildcard is supported in Name.

SYNTAX
    Disable-DkimDomain [[-Name] <String>] [<CommonParameters>]
# Disable-DkimDomain examples

Disable-DkimDomain
# This command disables all domains.

Disable-DkimDomain "emailarchitect.net"
# This command disables domain "emailarchitect.net".

Disable-DkimDomain "email*"
# This command disables domains that match "email*".

help Disable-DkimDomain -detailed
# This command gets detailed parameters information.

Remove-DkimDomain

The Remove-DkimDomain cmdlet removes domain(s) based on the domain name, wildcard is supported in domain name.

SYNTAX
    Remove-DkimDomain [-Name] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
# Remove-DkimDomain examples

Remove-DkimDomain "emailarchitect.net"
# This command removes domain "emailarchitect.net".

Remove-DkimDomain "email*"
# This command removes domains that match "email*".

# Remove-DkimDomain "emailarchitect.net" -Confirm:$false
# This command removes domain "emailarchitect.net" without confirmation.

help Remove-DkimDomain -detailed
# This command gets detailed parameters information.

New-DkimPrivateKey

The New-DkimPrivateKey cmdlet creates a new private key.

SYNTAX
    New-DkimPrivateKey [[-Use1024Key] <Boolean>] [[-ExportFile] <String>] [<CommonParameters>]
# New-DkimPrivateKey examples

New-DkimPrivateKey $true
# This command creates a key pair with 1024 length.

New-DkimPrivateKey $true -ExportFile 'C:\Program Files (x86)\EAExchDomainKeys\Certs\mydomain.pem'
# This command creates a key pair with 1024 length, and the key will be exported to mydomain.pem in pkcs8 format.

New-DkimPrivateKey $false
# This command creates a key pair with 2048 length.

Set-DkimDomain "emailarchitect.net" -PrivateKey (New-DkimPrivateKey)
# This command set a new private key generated by New-DkimPrivateKey to the domain.

help New-DkimPrivateKey -detailed
# This command gets detailed parameters information.

Import-DkimPrivateKey

The Import-DkimPrivateKey cmdlet imports a private key from pem file.

SYNTAX
    Import-DkimPrivateKey [[-ImportFile] <String>] [<CommonParameters>]
# Import-DkimPrivateKey examples

Import-DkimPrivateKey "c:\my folder\privatekey.pem"
# This command imports private key from privatekey.pem.

New-DkimDomain "emailarchitect.net" -PrivateKey (Import-DkimPrivateKey "c:\my folder\privatekey.pem")
# This command imports private key from privatekey.pem and use it for the new domain.

help Import-DkimPrivateKey -detailed
# This command gets detailed parameters information.

Export-DkimPrivateKey

The Export-DkimPrivateKey cmdlet exports a private key to pem file.

SYNTAX
    Export-DkimPrivateKey [[-PrivateKey] <String>] [[-ExportFile] <String>] [<CommonParameters>]
# Export-DkimPrivateKey examples

Export-DkimPrivateKey (Get-DkimDomain "emailarchitect.net").PrivateKey -ExportFile "c:\my folder\privatekey.pem"
# This command exports the private key from domain "emailarchitect.net".

help Export-DkimPrivateKey -detailed
# This command gets detailed parameters information.

Export-DkimPublicKey

The Export-DkimPublicKey cmdlet exports public key of the domain in DNS record format.

SYNTAX
    Export-DkimPublicKey [-Name] <String> [<CommonParameters>]
# Export-DkimPublicKey examples

Export-DkimPublicKey "emailarchitect.net"
# This command exports the public key from domain "emailarchitect.net".

help Export-DkimPublicKey -detailed
# This command gets detailed parameters information.

Get-DkimLogLevel

The Get-DkimLogLevel cmdlet gets current DKIM log level.

SYNTAX
    Get-DkimLogLevel [<CommonParameters>]
# Get-DkimLogLevel examples

Get-DkimLogLevel
# This command outputs current dkim log level (OnlyError|FullDebug|CrashDebug).

help Get-DkimLogLevel -detailed
# This command gets detailed parameters information.

Set-DkimLogLevel

The Set-DkimLogLevel cmdlet sets current DKIM log level.

SYNTAX
    Set-DkimLogLevel [-LogLevel] <String> [<CommonParameters>]
# Set-DkimLogLevel examples

Set-DkimLogLevel FullDebug
# This command sets current log level to full debug.

help Set-DkimLogLevel -detailed
# This command gets detailed parameters information.

Get-DkimLicense

The Get-DkimLicense cmdlet gets current DKIM license information.

SYNTAX
    Get-DkimLicense [<CommonParameters>]
# Get-DkimLicense examples

Get-DkimLicense
# This command outputs current dkim license information.

help Get-DkimLicense -detailed
# This command gets detailed parameters information.

Set-DkimLicense

The Set-DkimLicense cmdlet sets the license code.

SYNTAX
    Set-DkimLicense [-LicenseCode] <String> [<CommonParameters>]
# Set-DkimLicense examples

Set-DkimLicense "your license code"
# This command sets license code.

help Set-DkimLicense -detailed
# This command gets detailed parameters information.

Appendix: DKIM installation

C#, VB.NET can be used to manage DKIM programmingly. You can find the full sample project in DKIM installation path\DkimConfigSample.

Free Email Support

Not enough? Please contact our technical support team.

Support@EmailArchitect.NET

Remarks

We usually reply emails within 24hours. The reason for getting no response is likely that your smtp server bounced our reply. In this case, please try to use another email address to contact us. Your Gmail, Hotmail or Office 365 email account is recommended.