MAPI COM Surrogate processes left by Task Scheduler without a desktop session
I have an application that uses MAPI for email work. I have set up this application to run in Task Scheduler.
If I run this task with Run whether the user is logged on or not then the task leaves zombie COM Surrogate processes running after the task is finished.
If I leave this user logged in and run this task with Run only when the user is logged on then I don't get these COM Surrogate processes accumulating.
Why would MAPI and Outlook create these COM Surrogate processes when the user isn't logged in and how do I get it to clean up the task properly? I'd prefer not to require this logon session as it'll fail the process after the server reboots.
PS. I posted this also as https://learn.microsoft.com/en-us/answers/questions/2101658/zombie-com-surrogate-(wininetcacheserver)-processe but I've since discovered it's related to a desktop session, so asking a simpler question.