Backs up specified database master key.


dbatools - Backup-DbaDatabaseCertificate


Prompts for the export password, then logs into server1\sql2016 with Windows credentials then back up all database keys to the default backup directory.

ComputerName : SERVER1
InstanceName : SQL2016
SqlInstance : SERVER1\SQL2016
Database : master
Filename : E:\MSSQL13.SQL2016\MSSQL\Backup\server1$sql2016-master-20170614162311.key
Status : Success

Backup-DbaDatabaseMasterKey -SqlInstance server1\sql2016

Logs into sql2016 with Windows credentials then backs up db1’s keys to the \nas\sqlbackups\keys directory.

Backup-DbaDatabaseMasterKey -SqlInstance Server1 -Database db1 -Path \nas\sqlbackups\keys


This command was created by Chrissy LeMaire. You can find Chrissy on Twitter and his blog.