Skip to content
Discussion options

You must be logged in to vote

Even CreateProcessAsUser / WithToken would not change the outcome - it needs to happen from within an interactive login session. Neither the Windows Service nor the background scheduled task are from an interactive login session.

If all that prevents you from using a regular scheduled task is the fact you have a console showing up for your program and you do not want that, consider changing the subsystem from Console to Windows (or in csproj terms - a OutputType of WinExe).

If this is not enough, then you will probably need another layer of IPC. Right now you have this which does not work:

|------ non-interactive --------------------| |--- interactive -|
<exterior> -> always-running aspne…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by danmoseley
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Answer questions and provide assistance, not an issue with source code or documentation. area-System.Diagnostics.Process os-windows untriaged New issue has not been triaged by the area owner
3 participants
Converted from issue

This discussion was converted from issue #80050 on December 30, 2022 17:51.