SQL Server 2012: All Database and Log backups using PowerShell

In this post, I am going share scripts to take all database and log backups using SQL Server PowerShell.

Using T-SQL, we can also take all databases backup using one single script, but some of the Database Administrators like to perform this kind of task using PowerShell because sometimes it is much faster and it is executing from outside of the SQL Server.

SQL Server 2012 cmdlet introduced a new command to take database backups and the command name is “Backup-SqlDatabase”.

Execute below command in PowerShell to get the help of “Backup-SqlDatabase”:

PowerShell script to take all database backups:
Generating file name with the date.

PowerShell script to take all database log backups:
Generating file name with the date.

SQL Server PowerShell Database Backup

Anvesh Patel

Leave a Reply

2 Comments on "SQL Server 2012: All Database and Log backups using PowerShell"

Notify of
avatar
Sort by:   newest | oldest | most voted
malya
Guest

Hi this is Malya .I am Postgresql DBA.I want to Know how to do PITR in Postgresql.Could please send me a small practical on that.

wpDiscuz