# play alert sound $sound = new-Object System.Media.SoundPlayer; $sound.SoundLocation="c:\WINDOWS\Media\notify.wav"; $sound.PlayLooping(); $flag=$false; 1..10 | foreach { if($_ -gt 1){$flag=$true} else{sleep -s 1} if($flag) {$sound.Stop() } }
Lab Core | The Lab of MrNetTek
A blog about IT, technical solutions, and code.