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


Remove-DbaDatabaseMasterKey

Deletes specified database master key.

Screenshots

dbatools - Remove-DbaMasterKey

Examples

The master key in the master database on server1 will be removed if it exists.

Remove-DbaDatabaseMasterKey -SqlInstance Server1

Suppresses all prompts to remove the master key in the ‘db1’ database and drops the key.

Remove-DbaDatabaseMasterKey -SqlInstance Server1 -Database db1 -Confirm:$false

Author

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

Get-Help

From PowerShell, execute Get-Help Remove-DbaDatabaseMasterKey -Detailed for more information on this function.

Source Code

Want to see the source code? View Remove-DbaDatabaseMasterKey.ps1 on GitHub
 

Related commands