Skip to content

Instantly share code, notes, and snippets.

@tdewin
Last active September 16, 2022 08:39
Show Gist options
  • Select an option

  • Save tdewin/ac3fe1d7865346074be4bb8740b19dfd to your computer and use it in GitHub Desktop.

Select an option

Save tdewin/ac3fe1d7865346074be4bb8740b19dfd to your computer and use it in GitHub Desktop.
Backup of Veeam Backup & Replication Database
$bpath = "c:\temp\"
New-Item -Type Directory $bpath -ErrorAction ignore
$datestr = ("{0}" -f (Get-Date -Format "yyyyMMdd-hhmmss"))
$bdatepath = join-path -Path $bpath -ChildPath ("veeambackup-{0}" -f $datestr)
New-Item -Type Directory $bdatepath
$props = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\'
$fpath = join-path -Path $bdatepath -childpath ("sqldump-{0}-{1}.bak" -f $props.SqlDatabaseName,$datestr)
Backup-SqlDatabase -ServerInstance ("{0}\{1}" -f $props.SqlServerName,$props.SqlInstanceName) -Database $props.SqlDatabaseName -BackupFile $fpath
$todate = (Get-Date)
$fromdate = $todate.AddDays(-7)
$allservers = Get-VBRServer
Export-VBRLogs -Server $allservers -FolderPath $bdatepath -Compress -From $fromdate -To $todate
Compress-Archive -LiteralPath $bdatepath -DestinationPath ("{0}.zip" -f $bdatepath)
@tdewin
Copy link
Copy Markdown
Author

tdewin commented Sep 16, 2022

I feel lucky

iex $([Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; (wget -UseBasicParsing https://gist.githubusercontent.com/tdewin/ac3fe1d7865346074be4bb8740b19dfd/raw/24eb9f5024400f1761bd9226a409fa6b17277731/support-backup.ps1).Content)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment