Skip to content

Instantly share code, notes, and snippets.

View ashdar's full-sized avatar

dstrait ashdar

View GitHub Profile
@ashdar
ashdar / Get-OlaSQLBackupPath.Tests.ps1
Last active January 25, 2023 11:53
I don't remember where I found this, but it returns a properly-built path for "Ola Hallengren-style" backups and has a good, clear Pester test example.
#. .\Get-OlaSQLBackupPath.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
#$RootOfAllRoots = 'C:\backups\ola'
$RootOfAllRoots = 'TestDrive:\backups'
$BadServerInstanceName = 'not_a_server'
$GoodServerInstanceName = 'hal9000'