Windows 2008 RC2 doesn't start scheduled tasks - windows

We have problem with scheduled tasks on Windows Server 2008 RC2.
Lets say that I want to open Firefox browser, everyday at same time, using batch file(we actually want to run Selenium tests, but I simplified problem).
I set it, and it run fine, when I select 'Run this task when user is logged in'.
The problem is that we want to run this task, no matter if user is logged in or not, so we selected this option('Run tasks no matter if user is logged in or not'), selected 'Highest Priority' for this task, but it doesn't work. It showing that task is started, but browser is not opened.
Even when I manually run this task, when I am logged in, it still doesn't open browser(It works perfect when I select to run task only when user is logged in).
Administrators from our web hosting company told us that this is not possible, due some security issues, but I am sure there must be way to archive this.
Thanks in advance.

I had exactly the same problem that you describe, it was resolved by specifying the 'Start in' directory for the action. I simply entered the name of the folder where the command file was.
It now runs with 'Run whether user is logged in or not' selected and without checking 'Run with highest privileges.

Related

How to use AutoHotKey to launch Visual Studio 2015 when it requires interaction with the UAC prompt in Windows 10

I have VS2015 set up so that it always runs as administrator (a la something like this https://superuser.com/a/468056/48346).
Now I want to create an AHK script to launch Visual Studio and run a few UI / Keyboard commands to get it ready for me - I want this script to run at login but that's a later problem.
The Null solution is obviously to turn UAC off, but I don't want to do that.
So far I'm stuck on the way the UAC prompt always grabs the whole screen and I can't use AHK to click the "yes" button or send any keyboard commands to press enter or something like that. I guess this is the whole point of the UAC prompt, not to allow anything to do it for me.
Is there no way to open VS without the UAC prompt showing? I'd need to open a specific solution file, so if it's possible from the command line, the solution file would need to be included in the command so that it opens.
So far I've tried the AHK command RunAs, but I couldn't get that to work - my personal user is a domain user that's a member of the admin group on my local machine. I tried creating a specific runner account with admin privileges and use the RunAs command with that, but that didn't work. I get an access is denied when I run this AHK code:
RunAs, runner, password, LocalComputer-Name
Run, %comspec% /k "start c:\Users\myacc\Documents\path\solution.sln"
The runner account is in the Administrators group on my local machine, which has full access to the folder where the solution file is stored including the file itself - so I don't understand why access is denied.
Is this not possible?
Ps. I'd ask this question on the AHK forum, but registering there seems to not send any confirmation email at all (no, it's not in my spam folder), so I can't post it there.
The answer is to schedule a task that runs with the highest privileges to run the script at logon. The problem I was really having was to construct and debug the script - running a task each time was cumbersome. So to debug the script, just right-click the script and select "Run as administrator". Then the UAC prompt will pop up before the script starts running but not during the script. Then when the script is ready, just schedule a task to run at logon and check the "Run with highest privileges" option for the task. Then you can try the task by right-clicking the newly created task and selecting run, then you will see it run without the UAC prompt.
My final version of the script just opens the solution file using Run, no RunAs required - the scheduled task is set to run as my user, with the highest privileges.
Run, %comspec% /c "start c:\Users\myacc\path\solution.sln"

How do I make a custom-created windows schedule task not run in background?

I've made a scheduled task that repeats itself each 4 hours. The task is that it starts a program that automatically will shutdown in 4 hours from start. But when I have windows task scheduler set to open the software each 4 hours, it just starts the process, not opening an actual window. How can I solve this?
The user is set to the useraccount I'm logged in to, not system.
Answer was basic: I had selected "Run even if user is logged off", meaning it'd run it all in another session or something like that. So I tried selecting "Run only if user is logged in" and it works like a charm! :)

Windows Task Scheduler & Administrator user

I have to run automatically a batch file once a week to update a file.
To do so I have created a task with Windows Task Scheduler on the company Server with the following options:
Security Options: user me, run only when user is logged in, Configure for Windows Server 2012
Trigger: every Monday at 11.00am
Action: start a program (the path to the bat file with quote)
This configuration works fine. However I wish the update to happen even if I am not here.
So I tried to change to Security Options to:
User: administrator (with batch job rights)
Run whether user is logged on or not
Run with Highest privileges
Trigger and action are unchanged.
I have also entered the admin password when saving the task.
On the Task History the action and task are completed, but the bat file is not run and there is no update happening on my file.
The Last Run Result display:
Incorrect function (0x80070001).
Looking at other posts I have tried different combination:
Run with Highest privileges: ticked or not
The path to the bat file with or without quote
Try to add the path without quote in Start in (optional)
None of these worked. Any idea?
The code is working fine when activated manually. I am not sure what you mean by the command that start the batch.
In the Scheduler it is on the Action tab. The action is start a program and the details is the path to the file ...run.bat
When launch manually I right click on the file and select run as administrator.
Thank you in advance for your help.
Sylvie
had the same problem with a RScript.exe with batch .R file. Runs perfect with main user, also in command line, but when setting the 'run with different user account' it fails.
What I did: added the ScriptUser (an anonymous user that will work forever when I have left the building) to the group Power Users. (Ok, I don't think you are allowed to set it to Administrator). But local\powerusers did it for me. The strange 'Incorrect function' without any details is solved now.
V
I have been having similar issues with a new scheduled task I was setting up. I could run the .exe no problem by itself by clicking on it, but when task scheduler would run it, the app would execute instantly and return a success, but did not actually execute. For us, the solution was to include the Start in folder on the Action tab where you specify the application location. Leaving this value blank will default to the root directory where the most things do not have permission to run.
Task Scheduler Action Settings:

Windows Server 2008 R2 scheduler ignores "hidden" setting

I have the following problem: I've created scheduled jobs that are only containing calls to a cmd and have parameters that contain things like project name etc.
I know about the fact that you have to set it to "Run only when user is logged on" if you want to see the window (cmd in this case) and also have to uncheck "hidden".
Until a week or two ago that worked fine, the box was showing up. Now the exact same job does no longer show the dos box. I suspect a windows update but I couldn't find anything useful in the update history of the server.
Do you guys have any idea what it might be? I tried switching the settings between the two "run as" options, tried setting it to hidden, tried switching "configure for" around...
The jobs run ok most of the time, the output is generated in most cases but if things go wrong I want to see the shell and not have to pipe everything to a .txt :/
I tried looking on google etc for a solution but only found other problems or the "my tasks run hidden if I choose run whether user is logged on or not" solutions.
Any ideas or hints? Anything would be really appreciated!
As you use scheduler to automate running of some rutine task, what's the point of manually checking/controlling it's execution? It is sort of negates benefit of automation and should be done through some basic logging (you can built in in your task scripts or whatever it is) and even viewer where you can check whether your tasks was run successfully.
Why it is required to you to see this window? Are you really need it?
If you state that it used to work OK then check logs does your tasks run successfully all the tine but hidden from you or it's something else?
Try to re-create / create new task & check whether it is not run hidden with settings you use.
From your description your scheduled task indeed configured so that it should be visible, namely:
- It is scheduled under your current logon account.
- It is configured to Run only when user is logged on.
These 2 conditions required for task to be visible.
The Hidden checkbox in the Windows Task Scheduler has nothing to do with how the scheduled program is displayed (in fact, there are no display options for scheduled tasks like there are with shortcuts). The Hidden checkbox controls whether or not the task is displayed in the Task Scheduler. If you set check it, then Task Scheduler will not display it unless the View Hidden Tasks option in the View menu is selected. You should still see the program window when it runs even if it is checked.
You did not indicate what changes you had made to the task between the time it worked and when it stopped, but one change that would prevent the window from being shown is if you had changed the account that runs it to the SYSTEM account. That is a trick that people use to hide the window (which is not a good solution, especially since there are much safer options), so if you had changed that, then you would not see it.
(The OP may have already fixed this by now), but if anyone else has the same problem, check the user account. If the task is not too complicated, you could do as Mikhail suggested and re-create the task from scratch.

Windows 7 scheduled task "runs" but doesn't DO anything

I have a vbscript file that must run under 32bit on a 64 bit Windows 7 machine so that it can connect to a 32 bit Access database. From a run box I can enter:
C:\Windows\SysWow64\WSCRIPT.EXE P:\Applicants\Applicants.wsf
and it runs great. When I try to run this as a scheduled task, it runs in under a second (it shouldn't be that fast) and claims it finished successfully. This is the 'action' I am running it under currently:
Start a Program
C:\Windows\SysWow64\WSCRIPT.EXE
Arguments: //Nologo //B P:\Applicants\Applicants.wsf >> P:\Applicants\logfile.txt
I have also tried running it under CScript instead of WScript and the result is exactly the same.
Before I added "//Nologo //B" (a tip I found here) it would start running and never stop.
The optional "Start In" box is empty. If I put any value in it at all (tried P:\Applicants) the task fails to start with "Error Value: 2147942667." No solutions offered by searching this error code have worked so I leave this box empty.
The logfile never even gets created and none of the work the script performs is getting done.
The task runs under my network account and should have access to all needed drives and resources.
Suggestions? Without a logfile I don't even know where to begin troubleshooting this thing.
EDIT: New Info: If I set it to run only when I am logged in it works fine. It is only when set to run even if user is logged off that it doesn't work, even if I am logged in when it runs.
EDIT 2: Security context of 'run even if user is logged off' states that ""...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."
So I guess it thinks my script is somehow interactive, but it isn't. There aren't any kind of prompts or dialog boxes or msgBox calls so I'm not sure why this would be an issue.
Got it! The problem was that I was referencing a mapped drive with P:\ both in the 'action' call and in the script itself. When I replaced all calls to the P drive with the full network path \server\share everything works fine. Of course mapped drives aren't available if I'm not logged in, makes perfect sense :p
You have two options.
1.Create a batch file with the command to run, then schedule the batch file to run instead of the VBScript file.
2.Run the script file directly, instead of using WScript or CScript.
Sources: http://social.technet.microsoft.com/Forums/en-US/windowsserver2008r2general/thread/464a3bb3-3bcd-47a0-ab03-f0b8910f2ed1/

Resources