Task Scheduler Security Option - Run if user is logged in or not

using Windows Server 208 R2 Terminal Server - Running .NET 4.0 programs
We are running .NET 4.0 Windows Forms programs using Task Scheduler with the Security Option - Run whether user is logged in or not.
When the Task Scheduler starts these jobs they either not not run or they fail.
Questions:
1. What shell is used by Task Scheduler with the setting "run whether user is logged in or not" ?
2. Is there some way to detect this shell or environment in a .NET program?
I am trying to determine if I can modify the .NET programs so they will run in this shell with no errors.
Thank you
MisterT99

Hi Mister,
In addition, Since you need to launch a GUI application through Task Scheduler, so this task also need to run interactively.
However, if the item "Run whether user is logged on or not" is selected, tasks will not run interactively, so we need to select the "Run only when user is logged".
I recommend you can change the item "Change user or group" in security option and add a group, which will make sure your application will run interactively for all users in the group when the users logon.
If there is anything else regarding this issue, please feel free to post back.
If you have any feedback on our support, please click here.
Best Regards,
Anna Wang
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • [Forum FAQ] Group Policy Preferences Scheduled Tasks Item not working when the option Run whether user is logged on or not is selected

    Scenario:
    We use one of the following Group Policy Preferences Scheduled Tasks item to deploy a task to clients:
    Computer Configuration -> Control Panel Settings -> Scheduled Tasks -> New -> Scheduled Task (At least Windows 7)
    Computer Configuration -> Control Panel Settings -> Scheduled Tasks -> New -> Immediate Task (At least Windows 7)
    User Configuration -> Control Panel Settings -> Scheduled Tasks -> New -> Scheduled Task (At least Windows 7)
    User Configuration -> Control Panel Settings -> Scheduled Tasks -> New -> Immediate Task (At least Windows 7)
    (Note that on some platforms, "At least Windows 7" is replaced with "Windows Vista and later.")
    After designating a user account to run the task, we select “Run whether user is logged on or not” option, and “The Do not store password…”
    check box is automatically grayed out (See Figure 1).
    Figure 1
    After finishing configuring the task item, on a client, we run command
    gpupdate/force to forcefully update group policy. However, on the client, when we check if the task is listed in Task Scheduler snap-in, the task is not displayed, and when we run
    gpresult/h report.html to collect group policy result for troubleshooting, we see an error as similar as shown in the following figure (Figure 2).
    Figure 2
    Cause:
    To make the scheduled task run whether the user is logged on or not, we need to store the password of the designated user account. However, for the content of the scheduled
    task item is stored in Sysvol where it’s not safe to store passwords, this function has been deprecated.
    Workaround:
    We can run the task with system account
    NT Authority\System, or we can use specific user accounts to run the task when the given user is logged on. (See Figure 3)
    Figure 3
    Reference:
    MS14-025: Vulnerability in Group Policy Preferences could allow elevation of privilege: May 13, 2014
    http://support.microsoft.com/kb/2962486
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hello Everyone,
    Succeeded !!!!!!!
    Even i was struggling with this same Problem to execute a batch via Window scheduler and set the setting to "Run whether the user is logged in or not".
    I tried many time but the batch runs with " Run
    whether user is logged on" and not with "Run
    whether user is logged on or not".
    what i discovered is that there was one mapped drive
    path in my batch file which was not the complete path like y:/AR.qvw actually what i did i changed that map path to the complete path like \\servnamename\d$\AR.qvw and the batch executed successfully with the setting "Run
    whether user is logged on or not"
    The
    conclusion is that check the dependency of the script on external resources because when you check this option "Run
    whether user is logged on or not" It actually conflicts. This my discovery.
    If
    you have any question write me on [email protected]
    Thanks
    & Regards,
    Arun

  • Task Scheduler wont run when set to "Run whether user is logged on or not"

    Hi
    I have two 2008 R2 servers with the same task and pretty much the same powershell script the schedule is running.  The powershell just runs a daily snapshot of the server.  One server it runs fine with  "Run whether user is logged on
    or not" selected.  But when selected on the second server it won't run.  I mean, the schedule says its run, but the poweshell doesn't launch and do its job.  Everything is the same on each server apart from what is being snapshotted. 
    Even the location of where the snapshot is going is the same.  Same domain account, same password.  When I change it to "Run only....." it runs fine.  But the server may not be logged in all the time, so I need it to run whatever.
    Any help would be greatly appreciated.
    Thanks
    Matt 

    I'd check in the windows system and application event logs. Also check the task log.
    Event Viewer\Applications\Microsoft\Windows\TaskScheduler\Operational
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Task Scheduler won't run batch file automatically

    So, I have a folder filled with the program and the necessary resource files needed in order for it to function. When I start the batch file manually, (double-clicking) it functions as necessary. However, when i schedule it as a task, it either says it "the
    program has stopped working" "a file is missing" (although the file is indeed on the system and in the folder) or it starts the program but it opens it in cmd and opens up a text box with the directory of the folder. Also, I'm running a windows
    8.1 with a x64-bit OS.
    Any help would be greatly appreciated.

    Senor Vega,
    It sounds like it might be a permissions type issue keeping your file from running properly. 
    Check to see what type of user account it is set to run under. 
    It may be that it needs to run under an account with administrative privileges, which you would need to ensure that you have “Run with highest privileges” selected. 
    If you are running the task from a standard user account, make sure you select “Run whether user is logged on or not” and select a user from the administrators group.
    Also check the permissions of the batch file itself to make sure those are set properly.
    Hope this helps!
    Mike
    Windows Outreach Team – IT Pro
    Windows for IT Pros on TechNet

  • What's the best way to check whether a user is logged in or not?

    I have a question about basic session handling.
    I'm running Tomcat 5.0.30 and have a web application where users can register with a username and password, and then log into a "member site".
    What is the best way of making sure that a user actually has logged in or not?
    What I've done in previous applications I've made is that I've just put a simple variable into the users session after he has successfully entered his password (i.e. Boolean loggedIn=true). Then I just test if this flag is true to grant him access to the member site. Is that a smart way of doing it?
    Are there any libraries I can use which handles sessions for me in a secure way?
    All comments and suggestions are appreciated!

    Maintain a flag using session attributes it to one when the user is logs in set it to value.... and change set it zero or invalidate that session... when the user is logged out...
    use something like this while user had logged in
    session.setAttribute("flag",<unique_number>);
    for checking whether the user had logged in or not...
    if(Integer.parseInt(session.getAttribute("flag").toString())=!<unique_number>){
    out.println("The session had expired");
    out.close();
    }

  • Windows Server 2008 sp2 Task Scheduler missing next run time after restart

    Hi,
    I have the issue that there does not appear to be a fix for with a server 2008 sp2 (NOT R2) where after a restart all tasks are missing the next run time so I need to edit each task to add this time back in. I have tried  the hotfix in KB 950035
    but this when you run it is only for Vista and cannot be installed despite saying it's also for Server 2008.
    For some reason also this is Task Scheduler version 1 not 2 which I thought came with windows since Vista so SP2 should have it.
    Anyone got any ideas?
    Thanks,

    Hi Evans,
    Would you please let us know current situation of this issue?
    As Dave mentioned, Windows Server 2008 Service Pack 2 include all the previously released updates for Windows
    Server 2008.
    Based on your description, I understand that all scheduled tasks still miss the next run time on your Windows
    Server SP2 when the server restart. If anything I misunderstand, please don’t hesitate to let me know.
    On current situation, please open Properties of one problematic scheduled task, navigate to History tab, then
    check if find some relevant events or errors. Those may help us to go further analyze.
    If any update, please feel free to let us know.
    Hope this helps.
    Best regards,
    Justin Gu
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Task Scheduler Won't Run WBADMIN Backup

    After several weeks of trying, the backup (wbadmin) doesn't work from the task scheduler.  When I enter the WBADMIN Start Backup command directly into a command prompt, it executes perfectly and backs up everything it's supposed to, but for some reason,
    when that EXACT SAME COMMAND is executed from the task scheduler it starts, then immediately stops.  I opened the Task Scheduler, clicked on "Task Scheduler Library" in the left pane, and looked at the backup job in the top window of the center pane. 
    The "Last Run Result" column simply showed, "(0xFFFFFFFF")".  I also clicked on the job's History Tab, which showed 7 entries at the date/time the job is set to trigger, which indicated that the task started and completed, "successfully" within the same
    second (i.e. 01:00:00), but absolutiely nothing is backed up, nor are there any entries for the trigger date on the backup drive.
    This has happened four Sundays in a row, and each time, when I subsequently execute the WBADMIN command from a command prompt, it works correctly.  Any ideas about what I'm missing and/or doing incorrectly
    Creacon

    Thanks Jeff, but unfortunately, I've already done all those things from advice in a previous thread.  The task scheduler DOES schedule the task, and my History is not disabled. But when the Task Scheduler starts, it then stops immediately with two
    log entries: 1) "Action Completed", and in the lower history window "Task Scheduler successfully completed the task ...", and 2) a log entry saying "Task Completed", and in the lower history window, "Task Scheduler successfully finished...", but NOTHING
    is backed up.  I've gone through the task scheduler settings for the task, and everything seems ok, but no dice.  Yet, I can enter the EXACT SAME wbadmin command into a command prompt, and the backup works fine.
    Here's the actual "SCHTASKS" command that I entered to schedule the job:
    SCHTASKS /Create /SC  WEEKLY /D SUN /TN CTServerWeeklyBackup /RL Highest /ST 01:00 /TR "WBADMIN START BACKUP -backupTarget:f: -allCritical  -include:C:\,D:\CAB\,D:\Downloads\,D:\Extracts\,D:\SSLCert\,D:\Temp\,U:\CAB\,U:\Shares\,U:\Temp\  >
    C:\backupLogs.txt"
    The above command executed without incident, then I immediately checked the task scheduler, and the task was there, properly scheduled.  When the trigger time/day occurred, the task simply started then immediately stopped, yet when I enter just
    the WBADMIN command into a command prompt, it executes correctly, completely and without incident.
    Creacon

  • Task Scheduler Won't Run Task With Idle Condition

    When I schedule a task to run Disk Cleanup with a one minute idle condition the task does does not run successfully and provides the following run result.
    The Task Scheduler service has asked the task to run. (0x41325)
    If I manually run the task or remove the idle condition the task runs and completes successfully.
    Why won't the task start with an idle condition?

    Hi,
    I noticed that you set the idle time shorter than the waiting for idle time. In my opinion, we should set the idle time longer than the waiting for idle time if we schedule a task running during the idle contidion. As the documents described, the Task Scheduler service will verify that the computer is in an idle state every 15 minutes. If a task is set to start only if the computer is idle for 30 minutes, and the task waits for the computer to be idle for 10 minutes, then the task will launch in 5 minutes only if the computer has been idle for 25 minutes prior to the time the trigger was activated. The task will not start if the computer enters an idle state 5 minutes after the trigger is activated. For more information, please refer to Task Idle Conditions.
    Best Regards
    Dale

  • Assign Task is assigned to a specific user but the she can not see it in her ToDo list

    Hello,
    I am currently working on the first process (after upgraded it to LC ES 2 with SP2) and try to test by routing it to the next person but the user could not see it in her ToDo list nor receive any Task email.
    I checked for the process in the AdminUI and see that it is currently assign to that user and also check the email configuration but do not see any thing wrong. I also recorded it and see it is assign to that person. I then try to re-assign it to a different person but it still does not show in the next person's ToDo list. So I go to the log file and see there is an error as below:
    00000078 UserServiceIm W com.adobe.idp.taskmanager.dsc.userservicev2.UserServiceImpl createTaskFromDialogProperties WARNING!!! You have not specified any Form TLO/DCI settings, and have not specified any input data.  This task will be created without any form.Process: 1515F/1515F, Step Name: AssignTask0
    I tried to search for the error above but could not find any thing reference to it.
    Can any one please advise on how to fix it so the user can see it in their ToDo list when the task is assigned to them.
    Thanks,
    Han Dao

    Hi
    It sounds like you have not selected anything on the Presentation & Data tab of the Workspace Startpoint/User Service.
    You need to specify:
    Your Asset (the form you want to present to the user)
    An associated Action Profile (tells the server how you want the form rendered...typically it is set to Default which uses the Render PDF Form process)
    The variable to hold your data(typically an xml variable)
    Make sure these are set.
    Diana

  • I am running Windows 7. Sometimes when I try to open Firefox, I get a message that says Firefox is already running. I check task manager, no Firefox running. Have to log off then back on.

    Windows 7, HP Pavilion dv3, Firefox version 4.0.1 (new 5 version freezes up often, had to use earlier version)

    I rolled back to version 5 and then 4 because version 7 was slow to load and would freeze up often. The original problem started before I upgraded to version 7. How do I check to see if plug-in container.exe is listed?

  • Powershell commands won't run in Task Scheduler

    On a Windows 2008 R2 member server (Win 2003 domain), I can run a batch file like this on command line:
    "powershell.exe -noexit -noprofile -executionpolicy Unrestricted -file C:\Bin\Scripts\BitsTransfer-Server05.ps1"
    However, the batch file fails as a scheduled task, with following error:
    "Start-BitsTransfer : The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist."
    The job is scheduled under a service account which is a member of Domain Admin group. And, yes, I have checked "Run whether user is logged on or not" and "run with highest privileges". Logging on as that account to the server did not make a difference.
    I am able to run the scheduled jobs on other servers with the same account and same configuration without a problem. Thanks for any help.
    Jay Kulsh

    Jay
    Although you may have already found a resolution to your issue, I'm still going to post this note to benefit someone else. I ran into a similar issue.
    I basically used a different domain account to test and the task ran just fine. A couple of things to keep in mind and make sure of:
    1. The account being use to execute task must have "Logon as batch job"
    rights under the local security policy of the server. You must specified the account you need to run scripts/bat files.
    2. Make sure you are entering the correct password characters
    3. Tasks in 2008 R2 don't run interactively specially if you run them as "Run whether user is logged on or not". This will likely fail specially if on the script
    you are looking for any objects\resource specific to a user-profile when the task was created as the powershell session will need that info to start, otherwise it will start and immediately end.
    Example for $Path:
    mapped drive (\\server\share) x:\   vs.  Actual UNC path \\server\share
    4.
    Review your steps, script, arguments. Sometimes the smallest piece can make a big difference even if you have done this process many times. I have missed several times a character on the password or a semi-colon sometimes.
    Check the link provided and hopefully you or someone else can benefit from this info. Be safe.
    https://technet.microsoft.com/en-us/library/cc722152.aspx

  • Workflow does not start when PowerShell Script is run from Task Scheduler

    I have a PS script that updates an item in a SP2010 list so that a workflow will be started.  When I run the PS script manually from the PS window on the server it resides, the script runs flawlessly.  If I set a scheduled task on the same server
    to run the script with the same credentials as are being used in the PS window, the script runs, updated the info on the list, but DOES NOT start the workflow.  As we know, SPD workflows cannot be started by anonymous or system accounts.  It is as
    if the task scheduler adds a bit of information that makes the SP2010 list think the information was updated by one of these accounts even though the field in the list for the item being updated shows the correct account.
    HELP!!!
    D

    Hi,
    The issue might be related to the script or schedule task settings your configured. You’d better check the settings.
    For example, which option do you set to run the scheduled task? You may select “Run whether user is logged on or not” instead of “run only when user is logged on” as shown in this article:
    http://blog.pointbeyond.com/2010/04/23/run-powershell-script-using-windows-server-2008-task-scheduler/
    Hope it helps.
    Best Regards,
    Sally Tang

  • Why won't this script run in task scheduler properly?

    Hello,
    I've created a script find all opened windows applications on the local computer.  The script creates an html outfile to report the opened windows and who is logged in. 
    When I run this script from the Powershell ISE or from Powershell command line it works fine.  When I schedule this script to run in windows Task Scheduler (either in Windows 7 or on Windows Server 2008) and I use 'Run only when user is logged in' the
    script again runs fine and reports in the html file the opened windows.
    But when I am logged into the server and I schedule this script to run in windows Task Scheduler (either in Windows 7 or on Windows Server 2008) and I use 'Run whether user is logged in or not' the script will run without error, it creates the html report,
    but it does not list the opened windows applications  That part of the report is missing.
    Why would this happen?  Do I need to change something in my script to make this script work whether or not someone is logged in?
    Here is the script:
    $a = "<style>"
    $a = $a + "BODY{background-color:peachpuff;}"
    $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
    $a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
    $a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}"
    $a = $a + "</style>"
    get-wmiobject Win32_ComputerSystem | ConvertTo-HTML -head $a -body "<H2>Logged in UserID</H2>" -property username | Out-File C:\Powershell_Scripts\Test.htm ; Get-Process |where {$_.mainWindowTItle} |Select-Object name,mainwindowtitle | ConvertTo-HTML -head $a -body "<H2>Open Applications</H2>" | Out-File C:\Powershell_Scripts\Test.htm -Append
    Thank you.

    Its hard to get a full grasp of the errors from task scheduler.  Try rewriting the Action portion of the Scheduled Task in a cmd prompt (with or without the elevated credentials). When the cmd line runs, the cmd host will convert to a black
    powershell host and you will be able to read the errors.
    C:\> powershell.exe -command { update-help }
    or
    C:\> powershell.exe -noprofile -file c:\scripts\dosomething.ps1
    I solved a similar problem this week.  When I ran my script from within powershell, all the required modules are normally present and the script ran fine.  It was pretty clear which module I forgot to load at the beginning of the script once I could
    watch it from start to finish
    or, your script could dump the Error logs to a text file.
    $Error | select * | out-file c:\errors.txt
    Not the point.  Look at the task scheduler history first.  If the history is not enabled enable it. If it shows no error code then the script ran successfully but had an internal error.
    There is only one place that an error can occur. This will trap it and set the exit code which will be visible in the event history:
    $a=@'
    <style>
    BODY{
    background-color:peachpuff;
    TABLE{
    border-width: 1px;
    border-style: solid;
    border-color: black;
    border-collapse: collapse;
    TH{
    border-width: 1px;
    padding: 0px;
    border-style: solid;
    border-color: black;
    background-color:thistle;
    TD{
    border-width: 1px;
    padding: 0px;
    border-style: solid;
    border-color: black;
    background-color:PaleGoldenrod
    </style>
    Try{
    $username=get-wmiobject Win32_ComputerSystem |%{$_.username}
    $precontent="<H2>Logged in User: $username</H2><br/><H2>Open Applications</H2><br/>"
    $html=Get-Process |where {$_.mainWindowTItle} -ErorAction Stop|
    Select-Object name,mainwindowtitle |
    ConvertTo-HTML -cssuri c:\scripts\style.css -preContent $precontent -body "<body bgcolor='peachpuff'/>"
    $html | Out-File C:\Scripts\Test.htm -ErrorAction Stop
    Catch{
    exit 99
    This is really an exercise in how to manage background tasks.
    Using an error log is good assuming it is not the file system that you are having an issue with
    ¯\_(ツ)_/¯

  • Issue with Task Scheduler on win 2012 R2

    Hi All,
    I am running a powershell script on windows server 2012 R2. It runs fine when i run it with powershell.
    And when i create task and choose option " Run only when the user is logged in" it works fine.
    But the issue is when i select "Run whether is the user is logged in or not" And with highest privilege it doesn't work.
    Tried solution:
    created a folder (or two on a 64bit-windows):
    (32Bit, always)
    C:\Windows\System32\config\systemprofile\Dektop
    (64Bit)
    C:\Windows\SysWOW64\config\systemprofile\Desktop
    as the powershell creates a excel and saves it in the some folder.
    not sure what is causing it.
    Any help on this will be appreciated.

    Hi,
    From the
    Task Security Context article, we can get following description.
    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.
    Just a confirmation, did your PowerShell script involve any operation of mapped drive? If involved, please
    use the full UNC path and monitor the result. Please refer to following similar thread and check if can help you.
    Task
    Scheduler Problem (run whether user is logged on or not)
    Meanwhile, please open this scheduled task’s Properties and navigate to History tab, then check if find some
    relevant events.
    View Task Properties and History
    If any update, please feel free to let us know.
    Hope this helps.
    Best regards,
    Justin Gu

  • Task Scheduler Success on 2008 R2 but failure on 2012 R2

    Hi
    I have currently got an issue with a Scheduled Task. It does not appear to run and returns a Last Run Result of (0x1).
    So I went back to basics and created a simple task and compared between 2008 R2 and 2012 R2. On 2008 R2 the task completes and returns (0x0), on 2012 R2 the task returns (0x1).
    The Service Account that runs the task is a member of the Administrators Group on both servers.
    The task is to run a batch file that outputs the content of C:\ to a file called list.txt.
    @ECHO OFF
    DIR C:\ > C:\Temp\list.txt
    Options that are selected are as follows:
    Service Account set to Domain Account (Password is correct);
    Run whether user is logged on or not;
    Run with highest privileges;
    No Trigger set (task is run by right clicking);
    Action is Start a program (Program/script = TestScheduleTest.cmd, Start in optional = C:\Temp);
    Start the task only if the computer is on AC power;
    Stop if the computer swtiches to battery power;
    Allow task to be run on demand;
    Stop the task if it runs longer than 3 days;
    If the running task does not end when requested, for it to stop.
    Any ideas why on a 2012 R2 this would fail?
    Regards

    I would recommend referring to that: https://social.technet.microsoft.com/Forums/windowsserver/en-US/57c65328-d8c8-4e13-9b51-e017ae6c298c/task-scheduler-returns-0x1-code-when-run-whehter-user-is-logged-on-or-not-options-selected?forum=winserverManagement
    Mainly check that the account you use to run the scheduled task has the required privileges to run it (You can running the script with
    runas option in CMD and check if you get errors). Also, it might be possible that the batch file requires a privilege elevation.
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

Maybe you are looking for

  • How to handle multiple drives in LR

    HI! I am a wedding photog considering switching from ACR to LR. I have multiple external hard drives filled with images from past weddings. I actually work off of external drives. And of course all these drives are not connected to my computer at the

  • Itunes install errors on windows 7

    I try to install the newest version of itunes on my windows 7 but it gives me an error message about internet security. Itunes will install but once it opens my iphone 4s with ios7 will not connect and tells me to run the newest version of itunes. I

  • How do I create a photomerge in Photoshop Elements 13?

    How do I create a photomerge in Photoshop Elements 13 trial version?

  • Firefox mobile doesn't allow to type national symbols with external usb keyboard.

    I'm using Asus PadFone with it's native keyboard dock-station. When I try enter text on any text field in web page my keyboard layout is set to english. This doesn't hapen when i write text in Firefox search/url field. Tested with Russian and Lithuan

  • IDs of DraftMessage-Reference changing after Message.Refresh

    Hello, we have a very weird behavior when accessing messages in the Mailbox folder with 660048 incoming messages and 48 outgoing messages. We retrieve a reference to a draft message by creating it with the following code: Mail5 draftmsg = (GroupwareT