Play a WAV File With SoundPlayer
Play a Windows WAV sound from a script, synchronously or asynchronously.
Run the snippet to play a system WAV file.
01Command
Command
$ (New-Object System.Media.SoundPlayer "C:\Windows\Media\Alarm01.wav").PlaySync()02What it does
System.Media.SoundPlayer loads and plays uncompressed WAV files. PlaySync blocks until playback ends, which is ideal at the end of a build script, while Play runs asynchronously. Point it at any WAV path, such as one under C:\Windows\Media.
03Risk
!Warning: Only WAV files are supported; MP3 and other formats need a different player or the Windows Media libraries.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- SoundPlayer ClassEvidence: Plays .wav files; PlaySync blocks until the sound finishes.
Last verified: 2026-09-20 · Category: Media
06Related solutions
Grep on Windows: Select-String
Search inside text files and logs with regex, returning file, line number and match.
Zip Files with Compress-Archive
Create or update a .zip from any files or folder contents straight from PowerShell.
Test a TCP port connection on Windows with Test-NetConnection
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.