Initial commit

This commit is contained in:
Tyler Hale 2025-03-14 11:14:15 -06:00
parent 05e4e1894a
commit 09ad9fe725
Signed by: Tyler
GPG key ID: C7CC4B910D88EF96

11
SQL-Instance-Backup.ps1 Normal file
View file

@ -0,0 +1,11 @@
# Sql Instance Backup
$BackupRootPath = "E:\Backup"
$SqlServerInstance = "SQL-SERVER\INSTANCE"
$Dbs = Invoke-Sqlcmd -ServerInstance $SqlServerInstance -Query "SELECT name,database_id FROM sys.databases" -TrustServerCertificate
foreach ($Db in $Dbs) {
$BackupQuery = "BACKUP DATABASE [$($Db.name)] to DISK = '$BackupRootPath\$($Db.name).bak'"
Invoke-Sqlcmd -ServerInstance $SqlServerInstance -Query $BackupQuery -TrustServerCertificate
}