Below piece of code can be used to play a beep from a Powershell script. I have used in many of scripts where user interaction is required. Presenting a list of different sounds which can be played from a Powershell script.
Beep:
Hand:
Asterisk:
Please test and let me know your response. Thanks.
Beep:
- #--Statement to play beep from Powershell Scripts --#
- clear
- [System.Media.SystemSounds]::Beep.Play()
- #--Statement to play hand from Powershell Scripts --#
- clear
- [System.Media.SystemSounds]::Hand.Play()
- #--Statement to play Asterisk from Powershell Scripts --#
- clear
- [System.Media.SystemSounds]::Asterisk.Play()
- #--Statement to play Exclamation from Powershell Scripts --#
- clear
- [System.Media.SystemSounds]::Exclamation.Play()