if I play sounds manually they are played. Specifically I use PowerShell to play a wav file or to create a TTS output. I can also adjust the Windows sound volume via PS (found an according script here somewhere).
If I try to do the same via a service it does not work. Actually I use Jenkins to run an according PS script. But Jenkins is running as a service, so I assume that this could be the critical thing here.
However, I remember that I had done TTS successfully through the task scheduler. If I remember correctly, in that case there was no user actively logged on but it still worked. When the task was triggered by an event, the TTS message was spoken.
Subscribe to get latest updates