Fun Script to Never Run While in a Hospital

In class today a student asked about having a little fun and simulating a flat line heartbeat monitor.  He was sparked on to this by my demoing the PowerShell alert (beep): “`a”

$frequency = 2000            
$signature = @"
    [DllImport("kernel32.dll")] public static extern bool Beep(int freq,int duration);
Add-Type -MemberDefinition $signature -Name "Beeper" -Namespace Win32Functions -PassThru            
For ($i = 500 ; $i -le 1500 ; $i += 100)            
    Start-Sleep -Milliseconds $i            

Comments (1)