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?
Related
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.
At the moment I have a service which will execute from time to time a .exe file. As the service is run as the SYSTEM user, these subprocesses will also be executed by SYSTEM. Due to security reasons I would like these processes to be executed in the context of a different user without administrative priviliges. Is there a way to do this without having to store the username and the password of this user somehow? If not: How can I save these credentials in a secure way?
I am using C# for the service, but I think that this questions can also be answered in general.
I wrote a .NET console application that needs to be scheduled trough Windows scheduler. Such console performs some network and database activities and write a logfile. The application work if run on Desktop/Command prompt but if I try to run it trough the scheduler it refuse to start. Another issue I faced is the write access to the app folder. Even if I set permissions to the folder containing application binaries to be wrote by 'Everyone' the app seems unable to create the log file and/or append data to it. The problem fixes if I run the application with Administrator priviledges (on desktop) but if I define the Activity in the scheduler to Run with higher privildegs this will not fix it anyway.
Best course of action is to create a Service account with admin privileges and schedule the task under such account and select the option to run whether the user is logged on or off.
This approach is even more relevant where Active Directory is in place.
Hope this helps,
Apex
I found the issue... http://support.microsoft.com/kb/2452723
It seems that the "Start In" parameter of the Action should not contain quotes.
Of course the folder should be 'writetable' for the user assigned to the task.
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?
I need to create a task for task scheduler from c# code using a user and a password for creating it.
Then the program that is scheduled, I want to be runned using a different account then the user that was used for creating the task.
Is it possible ? If yes, how?
After you create a Scheduled Task in Windows, open the task properties. There should be a Run As textbox on the Task tab, that allows you to type in a different user's name. Then you can create a password.