Created
July 2, 2025 15:13
-
-
Save pollusb/00a47e7285af508e5ffb9e1da2282e58 to your computer and use it in GitHub Desktop.
PowerShell Console Beep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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