You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/Export-DbaInstance.ps1
+51-4Lines changed: 51 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,8 @@ function Export-DbaInstance {
32
32
All Availability Groups.
33
33
All OLEDB Providers.
34
34
35
+
When -IncludeDbMasterKey is specified: all database certificates (exported as .cer files; private keys exported as .pvk files when -EncryptionPassword is provided) and all database master keys encrypted with the -EncryptionPassword.
36
+
35
37
The exported files are written to a folder using the naming convention "machinename$instance-yyyyMMddHHmmss", making it easy to identify the source instance and export timestamp.
36
38
37
39
This command is particularly valuable for:
@@ -77,13 +79,25 @@ function Export-DbaInstance {
77
79
Required when generating restore scripts for databases backed up to Azure storage containers.
78
80
79
81
.PARAMETERIncludeDbMasterKey
80
-
Exports database master keys from system databases and copies them to the export directory.
81
-
Critical for environments using Transparent Data Encryption (TDE) or encrypted backups where master keys are required for restoration.
82
+
When specified, exports database certificates (.cer files) and database master keys (.key files) to the export directory.
83
+
Certificate private keys (.pvk files) are also exported when -EncryptionPassword is provided.
84
+
Database master keys require -EncryptionPassword to be specified; if omitted, only certificates are exported.
85
+
Use -Exclude DbCertificates to suppress certificate export while still exporting master keys.
86
+
87
+
.PARAMETEREncryptionPassword
88
+
Secure password used to encrypt exported certificate private key files (.pvk) and database master key backups (.key).
89
+
When specified with -IncludeDbMasterKey, enables export of private keys alongside certificates and also backs up database master keys.
90
+
Required for database master key export; optional for certificate export (without it only .cer files are generated).
91
+
92
+
.PARAMETERDecryptionPassword
93
+
Password required to decrypt the certificate's existing private key before it can be re-encrypted for backup.
94
+
Use this when certificates were originally created with a password or imported from a password-protected source.
95
+
Only applies when -IncludeDbMasterKey is specified and DbCertificates is not in -Exclude.
82
96
83
97
.PARAMETERExclude
84
98
Skips specific object types from the export to reduce scope or avoid problematic areas.
85
99
Useful when you only need certain components or when specific features cause export issues in your environment.
0 commit comments