New
#10
I've applied this tutorial to log off, log on, and shutdown, but it seems as though the shutdown sound doesn't audibly play half the time, even when Task Scheduler says it completed successfully, and when the path is both correct and as close to the C:\Windows\Media folder as possible. I think it's shutting down too quickly for PowerShell to play the sound, as when it plays, it's usually cut off midway. Is there a way to delay this so that it will play and then shutdown after it has finished playing? I think it might be possible with a bit of scripting.
Hello Robert, :)
I find that using a short playing sound works best because of this issue of it shutting down sometimes before the sound has finished playing.
I'm not sure about a way to delay the shutdown until the sound has finished playing.
That should be able to play then.
It wouldn't hurt to test by doing a Shift+Shutdown to see if there's any difference for you.
Turns out it wasn't playing due to a typo in the path to the wav file. Instead of "C:\Windows\Media\Distance Announcer\Shutdown.wav," I had it spelled as "Anouncer" in the task actions. Spelling it right would probably help.
Btw, when I run the command normally inside PowerShell, it tells me that the "-c" at the start isn't recognized as a cmdlet, function, script, etc, but the command still runs. I can also run it without -c at the start, and it doesn't give an error. Is there a point to having the -c at the start?
Great news on the sound playing now. It's always the simple mistakes that get us.
The command at step 10 was designed to run in a command prompt instead since that's what Task Scheduler uses.
PowerShell -c (New-Object Media.SoundPlayer 'C:\Windows\Media\Distance Announcer\Shutdown.wav').PlaySync();
Note: So I spent half a day figuring out how to get Shutdown sounds to work. I used Group Policy Editor and PowerShell ISE to do this workaround.
1. Create a .PS1 file with the script provided in the tutorial:
-c (New-Object Media.SoundPlayer 'C:\Windows\Media\Sound.wav').PlaySync();(Change C:\Windows\Media\Sound.wav to the full path of your wav file.)
2. Save the .PS1 file anywhere then copy it to C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown.
3. Open Group Policy Editor then navigate to:
Computer Configuration> Windows Settings> Scripts (Startup/Shutdown)> Double-click Shutdown on the right.
4. Click PowerShell Scripts Tab then Add...
5. Click Browse...
6. Double-click the PS1 file you created.
7. Set "For this GPO, run scripts in the following order" to Run Windows PowerShell scripts first. Then Apply and OK.
Hello @Nytr0s, and welcome to Ten Forums.
You might see if the tutorials below may help with logon and logoff sounds.
Play Sound at Logon (Sign-in) in Windows 10 | Windows 10 Tutorials
Play Sound at Logoff (Sign-out) in Windows 10 | Windows 10 Tutorials