Backup SQL Server 2016 Databases using Powershell

It is possible with SQL Server 2016 (possibly earlier as well) to use Powershell to backup your databases. If I ever need to do this I use the SQL Management console, however I’m using a Mac through RDP which means right click is not working ๐Ÿ™‚

It’s very easy to take the backup, set the variables, of server name, db name and output path.

$server = โ€œTWSQL1โ€$database = โ€œConfigMgrโ€$output = โ€œC:\Users\Administrator\Desktop\SQL\ConfigMgr.batโ€
Backup-SqlDatabase -ServerInstance $server -Database $database -BackupFile $output

How useful was this post?

Click on a star to rate it!

Leave a Reply