Skip to content

Instantly share code, notes, and snippets.

@pollusb
Created July 2, 2025 15:13
Show Gist options
  • Save pollusb/00a47e7285af508e5ffb9e1da2282e58 to your computer and use it in GitHub Desktop.
Save pollusb/00a47e7285af508e5ffb9e1da2282e58 to your computer and use it in GitHub Desktop.
PowerShell Console Beep
function Beep {
param (
[string]$slqInstance,
[int32]$spid
)
while ($true) {
$a = Invoke-DbaQuery -SqlInstance $SqlInstance -Query "exec sp_who2 $spid"
if ($a.Command -ne 'KILLED/ROLLBACK') {
1..3 | %{ [System.Console]::Beep((100 * $_ + 200), 300)} # 3 beeps with different pitch
} else {
Write-Host '.' -NoNewLine
}
Start-Sleep -Seconds 5
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment