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


Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

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