A PowerShell module is provided with DKIM 3.5, you can use this module to create/enable/disable/remove DKIM directly in PowerShell.
To use DkimPowerShell module, you need to open PowerShell and input the following cmdlet:
Import-Module "C:\Program Files (x86)\EAExchDomainKeys\DkimPowerShell"
Or you can start the Dkim Management Shell from "Install path\StartDkimShell"
Then you can use the following cmdlets to manipulate DKIM settings.
Get-DkimDomain New-DkimDomain Enable-DkimDomain Disable-DkimDomain Set-DkimDomain Remove-DkimDomain New-DkimPrivateKey Import-DkimPrivateKey Export-DkimPrivateKey Export-DkimPublicKey Get-DkimLogLevel Set-DkimLogLevel Get-DkimLicense Set-DkimLicense
NAME Get-DkimDomain SYNOPSIS Outputs one or more domain's objects in Dkim Manager. SYNTAX Get-DkimDomain [[-Name] <String>] [<CommonParameters>] DESCRIPTION The Get-DkimDomain cmdlet queries domain(s) from Dkim Manager based on the domain name, wildcard is supported in DomainName. It returns a domain(s) objects array. PARAMETERS -Name <String> <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Get-DkimDomain This command queries all domains and outputs domain objects array. Name : emailarchitect.net Selector : s1024 IsActive : $true CanonAlgorithm : 0 # 0: relaxed; 1: simple RsaHashAlgorithm : 1 # 0: rsa-sha1; 1: rsa-sha256 PublicKey : MIGfMA0GCS ... PrivateKey : -----BEGIN PRIVATE KEY----- ... SignedHeader : sender, from, to, cc, subject, date, message-id, references ... DisabledRecipientList : SignPartMessageLength : 0 IsSignPartOfMessage : $false IsSignSystemMessage : $false IsSignMapiMessage : $false IsSignDeliveryReport : $true IsSignPartOfDeliveryReport : $false IsWrapEmailAddress : $false IsRemoveExistedSignature : $true -------------------------- EXAMPLE 2 -------------------------- PS C:\>Get-DkimDomain "*" | Format-Table -Property Name, Selector, IsActive -AutoSize -Wrap This command queries all domains and outputs domain objects array in table format. -------------------------- EXAMPLE 3 -------------------------- PS C:\>Get-DkimDomain "emailarchitect.net" This command queries domain "emailarchitect.net" and outputs domain objects array. -------------------------- EXAMPLE 4 -------------------------- PS C:\>Get-DkimDomain "email*" This command queries domains that match "email*" and outputs domain objects array. REMARKS To see the examples, type: "get-help Get-DkimDomain -examples". For more information, type: "get-help Get-DkimDomain -detailed". For technical information, type: "get-help Get-DkimDomain -full". For online help, type: "get-help Get-DkimDomain -online"
NAME New-DkimDomain SYNOPSIS Creates a new domain in Dkim Manager. SYNTAX New-DkimDomain [-Name] <String> [[-Selector] <String>] [[-PrivateKey] <String>] [[-Use1024Key] <Boolean>] [[-IsActive] <Boolean>] [<CommonParameters>] DESCRIPTION The New-DkimDomain cmdlet creates a new domain in Dkim Manager. PARAMETERS -Name <String> The domain name to create. -Selector <String> The selector of the domain, default value is "s1024". -PrivateKey <String> The private key in pkcs8 format for DKIM signature. With default value, this cmdlet creates a private key automatically. If an existed private key is specified, the domain uses this private key. -Use1024Key <Boolean> If this parameter is $true (default), 1024 length of key pair is created; If this parameter is $false, 2048 length of key pair is created. If an existed private key is specified, this parameter is ignored, the key length depends on the private key. Because public key of 2048 key pair exceeds the single TXT record length limit of the DNS server, so using 1024 key is recommended. -IsActive <Boolean> If this parameter is $true, DKIM signature is enabled, otherwise it is disabled. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>New-DkimDomain "emailarchitect.net" This command creates a new domain named "emailarchitect.net". -------------------------- EXAMPLE 2 -------------------------- PS C:\>New-DkimDomain "emailarchitect.net" -Selector "selector1" This command creates a new domain named "emailarchitect.net" with selector 'selector1'. -------------------------- EXAMPLE 3 -------------------------- PS C:\>New-DkimDomain "emailarchitect.net" -Selector "s1024" -PrivateKey (Import-DkimPrivateKey "c:\my folder\privatekey.pem") This command creates a new domain named "emailarchitect.net" with selector 's1024', and it uses the private key imported from privatekey.pem. -------------------------- EXAMPLE 4 -------------------------- PS C:\>New-DkimDomain "emailarchitect.net" -Use1024Key $false This command creates domain "emailarchitect.net" with 2048 key pair. REMARKS To see the examples, type: "get-help New-DkimDomain -examples". For more information, type: "get-help New-DkimDomain -detailed". For technical information, type: "get-help New-DkimDomain -full". For online help, type: "get-help New-DkimDomain -online"
NAME Enable-DkimDomain SYNOPSIS Set IsActive property of one or more domains to $true in Dkim Manager. SYNTAX Enable-DkimDomain [[-Name] <String>] [<CommonParameters>] DESCRIPTION The Enable-DkimDomain cmdlet set Domain.IsActive property to $true based on the domain name, wildcard is supported in Name. PARAMETERS -Name <String> The domain name to enable, it supports full name or wildcard. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Enable-DkimDomain This command enables all domains and outputs domains -------------------------- EXAMPLE 2 -------------------------- PS C:\>Enable-DkimDomain "emailarchitect.net" This command enables domain "emailarchitect.net". -------------------------- EXAMPLE 3 -------------------------- PS C:\>Enable-DkimDomain "email*" This command enables domains that match "email*". REMARKS To see the examples, type: "get-help Enable-DkimDomain -examples". For more information, type: "get-help Enable-DkimDomain -detailed". For technical information, type: "get-help Enable-DkimDomain -full". For online help, type: "get-help Enable-DkimDomain -online"
NAME Disable-DkimDomain SYNOPSIS Set IsActive property of one or more domains to $false in Dkim Manager. SYNTAX Disable-DkimDomain [[-Name] <String>] [<CommonParameters>] DESCRIPTION The Disable-DkimDomain cmdlet set Domain.IsActive property to $false based on the domain name. Wildcard is supported in DomainName. PARAMETERS -Name <String> The domain name to disable, it supports full name or wildcard. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Disable-DkimDomain This command disables all domains and outputs domain names. -------------------------- EXAMPLE 2 -------------------------- PS C:\>Disable-DkimDomain "emailarchitect.net" This command disables domain "emailarchitect.net". -------------------------- EXAMPLE 3 -------------------------- PS C:\>Disable-DkimDomain "email*" This command disables domains that match "email*". REMARKS To see the examples, type: "get-help Disable-DkimDomain -examples". For more information, type: "get-help Disable-DkimDomain -detailed". For technical information, type: "get-help Disable-DkimDomain -full". For online help, type: "get-help Disable-DkimDomain -online"
NAME Set-DkimDomain SYNOPSIS Set 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>] DESCRIPTION The Set-DkimDomain cmdlet set the DKIM properties based on the domain name, wildcard is not supported in Name. PARAMETERS -Name <String> The Name parameter specifies the domain name to change, it only supports full name. -Selector <String> The Selector parameter specifies the DKIM selector. -PrivateKey <String> The PrivateKey parameter specifies the private key in pkcs8 format. -IsActive <Boolean> The IsActive parameter specifies whether the DKIM signature is enabled, default is $true. -CanonAlgorithm <Int32> The CanonAlgorithm parameter specifies the DKIM canonicalization algorithm. 0: relaxed (recommended); 1: simple -RsaHashAlgorithm <Int32> The RsaHashAlgorithm parameter specifies the DKIM signature algorithm. 0: rsa-sha1; 1: rsa-sha256 (recommended) -IsSignPartOfMessage <Boolean> Sign message headers only, default is $false. -IsSignDeliveryReport <Boolean> Indicates if signing delivery report, default is $true. -IsSignPartOfDeliveryReport <Boolean> Indicates if signing headers only for delivery report, default is $false. -IsSignSystemMessage <Boolean> Indicates if signing Exchange system message, default is $false. -IsSignMapiMessage <Boolean> Indicates if signing Exchange internal MAPI message, default is $false. -IsRemoveExistedSignature <Boolean> Indicates if removing existed DKIM signature before signing, default is $true. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -Selector "selector1" This command changes selector of domain to "selector1" -------------------------- EXAMPLE 2 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -IsActive $false This command changes "IsActive" property value to $false -------------------------- EXAMPLE 3 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -CanonAlgorithm 0 This command changes "CanonAlgorithm" property value to simple. 0: relaxed; 1: simple -------------------------- EXAMPLE 4 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -RsaHashAlgorithm 1 This command changes "RsaHashAlgorithm" property value to rsa-sha256. 0: rsa-sha1; 1: rsa-sha256; -------------------------- EXAMPLE 5 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -IsSignPartOfMessage $true This command changes "IsSignPartOfMessage" property value to $true -------------------------- EXAMPLE 6 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -PrivateKey (New-DkimPrivateKey) This command set a new private key generated by New-DkimPrivateKey. REMARKS To see the examples, type: "get-help Set-DkimDomain -examples". For more information, type: "get-help Set-DkimDomain -detailed". For technical information, type: "get-help Set-DkimDomain -full". For online help, type: "get-help Set-DkimDomain -online"
NAME Remove-DkimDomain SYNOPSIS Removes one or more domains from Dkim Manager. SYNTAX Remove-DkimDomain [-Name] <String> [-WhatIf] [-Confirm] [<CommonParameters>] DESCRIPTION The Remove-DkimDomain cmdlet removes domain(s) based on the domain name. Wildcard is supported in Name. It is not recommended to use wildcard in domain name. PARAMETERS -Name <String> The domain name to remove, it supports full name or wildcard. -WhatIf [] -Confirm [ ] <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Remove-DkimDomain "emailarchitect.net" This command removes domain "emailarchitect.net". -------------------------- EXAMPLE 2 -------------------------- PS C:\>Remove-DkimDomain "email*" This command removes domains that match "email*". REMARKS To see the examples, type: "get-help Remove-DkimDomain -examples". For more information, type: "get-help Remove-DkimDomain -detailed". For technical information, type: "get-help Remove-DkimDomain -full". For online help, type: "get-help Remove-DkimDomain -online"
NAME New-DkimPrivateKey SYNOPSIS Creates a new private key for DKIM signature. It returns the private key in pkcs8 format. SYNTAX New-DkimPrivateKey [[-Use1024Key] <Boolean>] [[-ExportFile] <String>] [<CommonParameters>] DESCRIPTION The New-DkimPrivateKey cmdlet creates a new private key. PARAMETERS -Use1024Key <Boolean> If this parameter is $true (default), 1024 length of key pair is created; If this parameter is $false, 2048 length of key pair is created. Because public key of 2048 key pair exceeds the single TXT record length limit of the DNS server, so using 1024 key is recommended. -ExportFile <String> If you specified a file name, the key will be exported to pem file with pkcs8 format as well. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>New-DkimPrivateKey $true This command creates a key pair with 1024 length. -------------------------- EXAMPLE 2 -------------------------- PS C:\>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 -------------------------- EXAMPLE 3 -------------------------- PS C:\>New-DkimPrivateKey $false This command creates a key pair with 2048 length.. -------------------------- EXAMPLE 4 -------------------------- PS C:\>Set-DkimDomain "emailarchitect.net" -PrivateKey (New-DkimPrivateKey) This command set a new private key generated by New-DkimPrivateKey to the domain. REMARKS To see the examples, type: "get-help New-DkimPrivateKey -examples". For more information, type: "get-help New-DkimPrivateKey -detailed". For technical information, type: "get-help New-DkimPrivateKey -full". For online help, type: "get-help New-DkimPrivateKey -online"
NAME Import-DkimPrivateKey SYNOPSIS Imports a private key from pem file. It returns the private key in pkcs8 format. SYNTAX Import-DkimPrivateKey [[-ImportFile] <String>] [<CommonParameters>] DESCRIPTION Import-DkimPrivateKey cmdlet imports a private key from pem file. PARAMETERS -ImportFile <String> The pem file full path. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Import-DkimPrivateKey "c:\my folder\privatekey.pem" This command imports private key from privatekey.pem. -------------------------- EXAMPLE 2 -------------------------- PS C:\>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. REMARKS To see the examples, type: "get-help Import-DkimPrivateKey -examples". For more information, type: "get-help Import-DkimPrivateKey -detailed". For technical information, type: "get-help Import-DkimPrivateKey -full". For online help, type: "get-help Import-DkimPrivateKey -online"
NAME Export-DkimPrivateKey SYNOPSIS Exports a private key to pem file in pkcs8 format. SYNTAX Export-DkimPrivateKey [[-PrivateKey] <String>] [[-ExportFile] <String>] [<CommonParameters>] DESCRIPTION Export-DkimPrivateKey cmdlet exports a private key to pem file. PARAMETERS -PrivateKey <String> The private key to export -ExportFile <String> The pem file full path. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Export-DkimPrivateKey (Get-DkimDomain "emailarchitect.net").PrivateKey -ExportFile "c:\my folder\privatekey.pem" This command exports the private key from domain "emailarchitect.net". REMARKS To see the examples, type: "get-help Export-DkimPrivateKey -examples". For more information, type: "get-help Export-DkimPrivateKey -detailed". For technical information, type: "get-help Export-DkimPrivateKey -full". For online help, type: "get-help Export-DkimPrivateKey -online"
NAME Export-DkimPublicKey SYNOPSIS Exports the public key of the domain. SYNTAX Export-DkimPublicKey [-Name] <String> [<CommonParameters>] DESCRIPTION Export-DkimPublicKey cmdlet exports public key of the domain in DNS record format. PARAMETERS -Name <String> The domain name to export <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Export-DkimPublicKey "emailarchitect.net" This command exports the public key from domain "emailarchitect.net". REMARKS To see the examples, type: "get-help Export-DkimPublicKey -examples". For more information, type: "get-help Export-DkimPublicKey -detailed". For technical information, type: "get-help Export-DkimPublicKey -full". For online help, type: "get-help Export-DkimPublicKey -online"
NAME Get-DkimLogLevel SYNOPSIS Gets current DKIM log level (OnlyError, FullDebug, CrashDebug). SYNTAX Get-DkimLogLevel [<CommonParameters>] DESCRIPTION The Get-DkimLogLevel cmdlet gets current DKIM log level. PARAMETERS <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Get-DkimLogLevel This command outputs current dkim log level (OnlyError|FullDebug|CrashDebug). REMARKS To see the examples, type: "get-help Get-DkimLogLevel -examples". For more information, type: "get-help Get-DkimLogLevel -detailed". For technical information, type: "get-help Get-DkimLogLevel -full". For online help, type: "get-help Get-DkimLogLevel -online"
NAME Set-DkimLogLevel SYNOPSIS Sets current DKIM log level (OnlyError, FullDebug, CrashDebug). SYNTAX Set-DkimLogLevel [-LogLevel] <String> [<CommonParameters>] DESCRIPTION The Set-DkimLogLevel cmdlet sets current DKIM log level. PARAMETERS -LogLevel <String> The log level (OnlyError, FullDebug, CrashDebug) to set. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Set-DkimLogLevel FullDebug This command sets current log level to full debug. REMARKS To see the examples, type: "get-help Set-DkimLogLevel -examples". For more information, type: "get-help Set-DkimLogLevel -detailed". For technical information, type: "get-help Set-DkimLogLevel -full". For online help, type: "get-help Set-DkimLogLevel -online"
NAME Get-DkimLicense SYNOPSIS Gets current DKIM license information. SYNTAX Get-DkimLicense [<CommonParameters>] DESCRIPTION The Get-DkimLicense cmdlet gets current DKIM license information. PARAMETERS <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Get-DkimLicense This command outputs current dkim license information. REMARKS To see the examples, type: "get-help Get-DkimLicense -examples". For more information, type: "get-help Get-DkimLicense -detailed". For technical information, type: "get-help Get-DkimLicense -full". For online help, type: "get-help Get-DkimLicense -online" NAME Get-DkimLicense SYNOPSIS Gets current DKIM license information. SYNTAX Get-DkimLicense [<CommonParameters>] DESCRIPTION The Get-DkimLicense cmdlet gets current DKIM license information. PARAMETERS <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Get-DkimLicense This command outputs current dkim license information. REMARKS To see the examples, type: "get-help Get-DkimLicense -examples". For more information, type: "get-help Get-DkimLicense -detailed". For technical information, type: "get-help Get-DkimLicense -full". For online help, type: "get-help Get-DkimLicense -online"
NAME Set-DkimLicense SYNOPSIS Sets the license code for DKIM plugin. SYNTAX Set-DkimLicense [-LicenseCode] <String> [<CommonParameters>] DESCRIPTION The Set-DkimLicense cmdlet sets the license code. PARAMETERS -LicenseCode <String> <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>Set-DkimLicense "your license code" REMARKS To see the examples, type: "get-help Set-DkimLicense -examples". For more information, type: "get-help Set-DkimLicense -detailed". For technical information, type: "get-help Set-DkimLicense -full". For online help, type: "get-help Set-DkimLicense -online"
See Also
Using DomainKeys/DKIM
Deploy Public Key in DNS server
Test DomainKeys/DKIM signature
Troubleshooting
Using Selector
Using Sender Rule
Server Core and Installer Command Arguments
Appendix - Set up SPF record in DNS server
Appendix - Set up DMARC record
Appendix - DKIM/SPF/DMARC Inbound Authentication in Exchange Server