Dela via


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)            
{            
    [Win32Functions.Beeper]::Beep($frequency,300)            
    Start-Sleep -Milliseconds $i            
}            
            
[Win32Functions.Beeper]::Beep($frequency,3000)

Comments

  • Anonymous
    January 01, 2003
    thanks