dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Backup-DbaDatabaseCertificate

Exports certificates from SQL Server using SMO and outputs the .cer and .pvk files.

Screenshots

dbatools-Backup-DbaDatabaseCertificate

Examples

Exports all the certificates on the specified SQL Server to the default data path for the instance.

Backup-DbaDatabaseCertificate -SqlInstance Server1

Connects using sqladmin credential and exports all the certificates on the specified SQL Server to the default data path for the instance.

$cred = Get-Credential sqladmin
Backup-DbaDatabaseCertificate -SqlInstance Server1 -SqlCredential $cred

Exports only the certificate named Certificate1 on the specified SQL Server to the default data path for the instance.

Backup-DbaDatabaseCertificate -SqlInstance Server1 -Certificate Certificate1

Exports only the certificates for AdventureWorks on the specified SQL Server to the default data path for the instance.

Backup-DbaDatabaseCertificate -SqlInstance Server1 -Database AdventureWorks

Author

This command was created by Jess Pomfret. You can find Jess on Twitter.

Get-Help

From PowerShell, execute Get-Help Backup-DbaDatabaseCertificate -Detailed for more information on this function.

Source Code

Want to see the source code? View Backup-DbaDatabaseCertificate.ps1 on GitHub
 

Related commands