I have set up a scheduled task to restore the shutdown sound Windows 10 (Pro) is missing by default. I set up that event 1074 triggers powershell.exe playing the sound with this argument:
-c (New-Object Media.SoundPlayer 'F:\Folder\shutdown.wav').PlaySync();
The sound starts to play but gets cut in 1-2 seconds, although there's time to finish it before the computer actually shuts down. I started to look for a way to set a minimal duration the task would run without interruption or the computer shutting it down. I was happy to find this thread: Play a sound (maybe WAV?) from Windows line command, and thought I could utilize a modified argument:
-c (New-Object Media.SoundPlayer 'F:\Folder\shutdown.wav').Play(); Start-Sleep -s 10; Exit;
This would play the first 10 second of the sound which is actually 8 seconds long, but still interrupts the same way after 1-2 seconds.
Are there any other arguments I could utilize to achieve that the sound gets played before the computer shuts down?
Thank you