Run Task Scheduler task in user interactive mode even windows is lock - c#

Is there any way to trigger some task from task scheduler as interactive task. Like if I am logged in and have a task that runs only if user is logged in than my 2nd application from code I send interactive commands like enter but it doesn't work if my windows is locked and task scheduler runs a application than it will not able to get user interactive command from my 2nd application .
I tried to create task in scheduler using Users group and run task weather user logged in or not but nothing works when windows get locked.

Related

Task scheduler can't show GUI of the application after login (Run whether user is logged on or not mode) - How bypass it with C#

Please take a look at this thread :
Task scheduler can't show GUI of the application after logout and login (run whether user is logged on or not)
This seems to be the way that recent versions of Windows TaskScheduler.
According to Microsoft (emphasis added):
You can specify that a task should run even if the account under which the task is scheduled to run is not logged on when the task is triggered. To do this, select the radio button labeled Run whether user is logged on or not . If this radio button is selected, tasks will not run interactively. To make a task run interactively, select the Run only when user is logged on radio button.
Essentially, if you select 'Run whether user is logged on or not', the process will not start a UI.
I need to start app before user's login.
So i chose Run whether user is logged on or not radio button.
But in this mode i can't see GUI after login.
I need a trick in c# or other way to show that app's UI after login.

Running .net exe file using task scheduler issue

I have a C# program that I need to run on a scheduled basis. The program will initially load the web browser control and do some task. I have tried running the program by itself and it works well. But it will not run when called by a task scheduler job. This is my only scheduled task that requires a GUI to run. Is there a workaround to do this?
For you to do this you have to set up the task scheduler to "Run Only When User is logged on"
See picture:
[]1[]
More details on my blog on how to do this.

Programmatically getting credentials of a Scheduled Windows Task

I have a program which I want to run as a scheduled windows task.
The windows task is predefined to run under a specific user account - credentials entered manually via the Scheduled Tasks UI.
Is there a way to programmatically get that predefined user's credentials (name, password and domain) when the program is initiated as a task, and use them for other purposes?
I've found several articles which explain how to create a task and "feed" it with credentials, but not the other way around. Is it even possible?

Cannot receive UDP packets from app run via Task Scheduler

I created a small C# app with Visual Studio 2012 that I want to use messages with to another app. This app uses UI Automation to grab text from another running app. I need to run this as an administrator because otherwise it cannot grab the text I need since that other app apparently runs under an adminstrator account as well.
My client app needs to run under any account, elevated or unelevated, hence the reason why I separated the admin part from it. The idea was to get the info I needed from the app granted admin rights and broadcast it to the other app via UDP.
Unfortunately, this doesn't work out so well.
If I open both tasks via Explorer it works, but if I open the listener/client app myself using Explorer and try to have the admin portion run automatically via Task Scheduler I never see the broadcasts. I set it up to run both on start and on logon and have specified an admin username/password. I can see the admin app running in Task Manager but don't get the UDP broadcasts.
My understanding is that apps started through Task Scheduler don't have UI access, but are their local socket communications blocked as well?

Scheduled task user not logged in, how to change to interactive mode once user logs in

I have a scheduled task that runs an app; let's say notepad.exe. If the task "runs only when a user is logged in," I can see notepad, but if the task "runs whether user is logged in or not" notepad does not run in interactive mode. And even if I am logged in and run the task in this mode, I cannot see the notepad window or the process until I select "show all" in task manager. The problem is when notepad has an error, upon logging in, I cant see that error so there's no way of telling what the error is or what notepad was doing when it got the error. It looks like the task cant run in interactive mode since there is no logged in user at the time it starts. So my question is: is there a way to change notepad to interactive mode once a user does log in?
Looking at a programmatic solution, is there a way of using shell32 or user32 to change an application to interactive mode at run time?
Also, my issue is not with notepad obviously... just a proof of concept.
I don't know a lot about Scheduled Tasks, but if they behave like a service, then you will have a hard time getting into these windows. In a service when you enable a service to interact with the Desktop, if you want to see the windows that the service opens, then you need to give him a user account, and you'll only be able to see the windows if you're logged in into that account, and only when a new window is opened; when a new window is opened you get a notification in the Desktop (if my memory serves me well is in the top of the Desktop) that you have to click in order to see the opened application.
If you can modify the application of the scheduled task, then I recommend you to make it non gui and to report errors to either the Event Viewer or a log file. If you can't modify the application of the scheduled task, then you may try wrapping it as a service, so you get the notifications when a new window is opened.

Categories

Resources