dbatools is a free PowerShell module with over 300 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-DbaDatabase

Performs a backup of a specified type of 1 or more databases on a SQL Server Instance.

These backups may be full, differential or transaction log backups.

More features coming soon!

Screenshots

Examples

This will perform a full database backup on the databases HR and Finance on SQL Server Instance Server1 to Server1’s default backup directory.

Backup-DbaDatabase -SqlInstance Server1 -Databases HR, Finance

Backs up AdventureWorks2014 to sql2016’s C:\temp folder.

Backup-DbaDatabase -SqlInstance sql2016 -BackupDirectory C:\temp -Database AdventureWorks2014 -Type Full

Performs a full backup of all databases on the sql2016 instance to their own containers under the https://dbatoolsaz.blob.core.windows.net/azbackups/ container on Azure blog storage using the sql credential “dbatoolscred” registered on the sql2016 instance.

Backup-DbaDatabase -SqlInstance sql2016 -AzureBaseUrl https://dbatoolsaz.blob.core.windows.net/azbackups/ -AzureCredential dbatoolscred -Type Full -CreateFolder

Author

This command was created by Stuart Moore. You can find Stuart on Twitter and his blog.

Get-Help

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

Source Code

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

Related commands