I'm handling a small sys-admin role at my business and have a task to record a voice signature during a web app session using a PowerShell script. The script checks for a specific title bar in Edge, records audio with ffmpeg, encrypts it with gnupg, and uploads it with curl. I've faced reliability issues: startup items crash, Task Scheduler often misses triggers, and multiple script instances spawn unexpectedly. The lid closing while recording seems to lead to the most problems. I'm considering whether creating a service is a better solution, but I'm not familiar with that. Any advice on improving the reliability of this process? Is NSSM safe to use with Windows 11?
5 Answers
Honestly, I think you're better off writing a small C# application. It’s more suited to long-running tasks compared to PowerShell. PowerShell's learning curve is gentler, but for this task, C# would be more dependable.
I agree that making this function as a service would definitely help with stability. Crafting a simple C# service can run your script on startup and handle errors more gracefully. You could get the code structure from Github and modify it to fit your needs.
That sounds promising! Can a Windows service also access the WindowTitle from a user's process?
You might try implementing a while loop in your script to keep it running. Just make sure to handle exceptions carefully and maybe include a slight delay to prevent crashes. It's messy, but it might maintain stability during lid openings.
I’ve been trying that, but sometimes it still crashes. Task Scheduler is inconsistent, which complicates things further.
Using NSSM can be a good option to turn your script into a service. Just keep in mind that while it hasn’t been maintained recently, many find it works fine on Windows 11 for handling background tasks without crashing.
Is it really safe to use NSSM? I’ve heard mixed reviews since it seems outdated.
Have you thought about using a web solution instead? It seems like this task could be handled more reliably within the web app itself rather than relying on a script.
Unfortunately, we can’t modify the carrier provided web app, which is why I need a script.

I’ll consider that, thanks for the tip! I want something that can handle these processes better.