Windows Server 2008 R2 scheduler ignores "hidden" setting - windows

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.

Related

Counting computer login times for the week

I am probably asking this question in the wrong place (Maybe I should go to an OS forum) - but I still want to know this.
I am using a windows- 7 machine for my work. I log in everyday, do some work and then log off. I take a few short breaks in between when I Lock (Windows+L) my laptop.
I have to account for the number of hours worked by the end of the week which means the time for which I was logged in to this machine.
The problem is that I do complete all the work that is assigned to me, but I forget to keep track of the exact hours I was logged into this machine. I may have logged in at 5 am in the morning and then logged off at 3 in the afternoon- and I dont have any manual logs of my time.
Is there someplace where windows keep a weekly track of
Say per day:
"The Latest log-off time - The Earliest Log in time" into that system for a particular day. I only need these logs for a week.
any heads up would be appreciated. Thanks
I have tried to solve this problem for years, but only recently found a solution that:
May be implemented without administrative privileges
Does not require extra software
Kudos to Guiding Tech for providing the solution shown below. Change the suggested folder and filenames as you desire, but adjust the batch file code and Task Scheduler commands accordingly.
Part One: Create the script
Create the folder where you would like the script and text log file of login and lock/logoff to reside. For this example, I will presume the desired folder is "C:!Scripts\Login\"
Create a new text file in the folder and name it login.bat. A quick way to do this is to right-click a blank space in the folder view, and select New > Text Document, then name it login.bat.
Open the text file and copy and paste in the following code:
echo off
set datecode=%date:~-4%-%date:~7,2%-%date:~4,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
if "%1"=="i" echo %datecode% - Logged in >> C:\!Scripts\Login\login.txt
if "%1"=="o" echo %datecode% - Locked computer >> C:\!Scripts\Login\login.txt
Save the new batch file
Part Two: Create the login task
Open Task Scheduler. Press the Windows key, and then type "Task Scheduler" and click on the application that appears with that name. Alternatively, use Start > Run (Win + R), type taskschd.msc and press Enter.
Select Create Task... from the actions on the right hand side
Enter a task name like "Log the login date and time"
Click on the Triggers tab and add a new trigger. Select:
Begin the task: At log on
Specific user: This should be your Windows account name.
Click OK to add the trigger.
Add another trigger, except this time select Begin the task: On workstation unlock. Click OK to add the trigger.
Click on the Actions tab. Add a new action and point it to your login script with the argument i.
Click OK to add the action.
7. (Optional – Only required if you are using a laptop) Click on the Conditions tab and uncheck the box that says Start the task only if the computer is on AC power. Click on OK to create the task.
Part Three: Create the lock task
In Task Scheduler, select Create Task… from the actions on the right hand side.
Enter a task name like Log the lock date and time.
Click on the Triggers tab and add a new trigger. Select:
Begin the task: On workstation lock
Specific user: This should be your Windows account
Click OK to add the trigger.
Click on the Actions tab. Add a new action and point it to your login script with the argument o.
Click OK to add the action.
(Optional – Only required if you are using a laptop) Click on the Conditions tab and uncheck the box that says Start the task only if the computer is on AC power. Click on OK to create the task.
Part Four: Testing that everything is working as expected
Your work is now complete. You just need to test that everything is working as expected. Just lock your computer by hitting WIN+L and log back in. If you followed the instructions properly, you should now have a file called login.txt in the same folder as your script. This file should contain a log of each time you log in and out of your computer.
You can use the event log to check when you logged in and logged put (or locked the PC for that matter) but you would have to do that by hand.. You could write a program to do that but that would be hard.
BTW: You will need to enable a group policy or something to enable login events. Have a look here

Windows 2008 RC2 doesn't start scheduled tasks

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.

VBS Stop option forced to kill on 1 sec :(

I was writing a vbs script to monitor a process and restart it if it died.
however as i was new to vbs i made a mistake in identifying the running process and had a infinate loop of starting a new version and hence crashed my pc....
i have fixed the code to work properly now but in the script properties>script tab the "stop script after specified number of seconds" has been set to 1 and if i disable this option and kick apply.. its still set :( this has only started being like this after i opened a billion cmd consoles and crashed my pc.... is this some sort of security feature.. how do i disable it.
Had exactly the same problem on W7 Ultimate.
The following article was helpful:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wsh_setindivprops.mspx?mfr=true
"To set global properties for all scripts that are run with the Windows-based script host
1. Click Start, and then click Run.
In the Open box, enter wscript, and then click OK. The Windows Script Host Settings dialog box appears.
Select the Stop script after specified number of seconds check box.
In the seconds box, enter the time limit you want to place on all scripts.
"
Just delete the [scriptname].wsh file in the same directory as the script. Possibly that's been made read-only or similar?
That's the file that contains the settings. You can find more details in this MSDN article: Setting and Customizing Script Properties (.wsh)
Edit: Some new suggestions that might help:
Try going to this key in the registry: HKLM\Software\Microsoft\Windows Script Host\Settings and checking if there is a setting in there that might be the reason. Might be worth going to the same path but under Current User as well (so HKCU\Software\Microsoft\Windows Script Host\Settings).
Otherwise there is an option in the Group Policy Editor called Maximum wait time for Group Policy scripts. I don't think this would affect you but might be worth making sure.
Finally, if neither of the above suggestions help maybe either of the following might at least alleviate the problem:
There is a property called WScript.Timeout which you can set at the beginning of your scripts (like WScript.Timeout = 60) that might help.
There is also a command line parameter \T to wscript that can be used to setting the timeout as described here.

Application started by user or another application?

This is a very general question:
I was wondering whether it is possible to find out whether an application (any kind of application no matter if it a delphi-application or java or whatever) was started by a user or by another application? And if it is possible and I see that an application was called by another one, can I find out what the "father" application is, that called the new programm?
Thnx in advance!
EDIT: Maybe it is too general - How can I see whether a Delphi application has a parent application with Delphi itself, e.g. one application was started by a service and I need to find that service?
Every single running application has a parent application, which launched it (except for root system process).
It is not possible to tell, whenever it is user who directly clicked on application to lauch it or not.
Example: take Explorer shell (not Internet Explorer).
You can double click on any application to launch it. The parent process will be explorer.exe.
You can right-click on any file and a bunch of context menu extenders will load. Some of them may launch external applications to, say, create a preview of video-file (I saw this, swear!). The parent process will be explorer.exe, but user didn't indended to lauch any application. He just wants to view file's properties. He didn't even know, that applications were lauched!
Example: take Total Commander or any other two-panel file managers, which supports plugins for archives.
You can double click on any
application to launch it. The parent
process will be totalcmd.exe.
You may enter archive file and copy
(extract) few files from it to your
Documents folders. Corresponding
plugin may handle extraction by
itself or run invisible process to
handle all work. All you see is
progress bar in Total Commander. But
there is a new proces and its parent
is totalcmd.exe again.
There are no differences between cases 1 and 2 in both examples.
BTW, the definition "started by user" is unclear. You even may say that nothing can happen without user's command. All those background processes in cases #2 were launched because user asked for it. Well, user didn't asked for lauch explicitly, but he asked for operation itself.
You don't mention if you want to do this programmatically or if you're looking for a tool to just show the information.
If you just want to view the information, you can use Process Monitor, part of SysInternals:
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
In the Tools menu, there is a 'Process Tree' view that shows you a tree with parent / child process relationships and as well as the owner of each process.
If you want even more detail about processes, look at Process Explorer:
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
if it started by the user from windows so the parent will be explorer.exe, otherwise the parent will be the application which run the process.
to check the parent of a process by using tool check Ander Miller reply.
Did you see this question?
I'm not sure that I see problem right now.

Clearing the Windows "Run" dialog history without rebooting

I am currently working on a program to immediately clear the list of previously-run-commands which appears in the Windows Start -> Run dialog. The procedure for clearing this list by removing the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU key is well documented; however, before these changes take effect, it seems to be necessary to do one of the following:
Restart the computer
Select Start -> Shut down, and then select Cancel.
Neither of these is ideal for the task I am trying to accomplish: #1 is extremely disruptive to the user, and #2 appears to require additional user interaction.
Does anyone know how to immediately (and programmatically) force a reload of this information without requiring any user interaction, while also minimizing disruption of the user's other activities? I would like for the user's Run history to be cleared out immediately after executing my program, without requiring any further action on their part (such as using the "Shut Down" -> "Cancel" trick in #2 above) or forcing a reboot.
Or, to approach the problem from a different angle: When clicking Start -> Shut Down -> Cancel, Windows Explorer reloads the RunMUI key. Is there a way to force a similar reload without having the user select Shut Down and then Cancel?
Things I have already tried:
Monitoring the explorer.exe status using procmon while selecting Shutdown and then Cancel. I see Explorer writing to the RunMRU key, but have not been able to determine what triggers this.
Numerous Google searches along the lines of "reload runmru without reboot". Most results still recommend method #1 above, although a few suggest #2.
Limited MSDN API examination. The RegFlushKey call appears promising, but I haven't ever used it before, so I don't know if it will apply to registry information cached by different processes.
Any suggestions or other information would be greatly appreciated.
Have you tried ccleaner?
http://www.ccleaner.com/
Not a full answer to your question, but I did find a third way to trigger the clearing of the run command from this article in PC Mag.
Killing explorer.exe and then restarting it will also clear the run list after the registry modification.
I have a nasty hack for you. Show the window programatically, hide it immediately (programatically) and click cancel on it (well, you guessed, programmatically).
You might try looking for the icon cache flush API, or other ones, I wouldn't be too suprised if they had side effects like the one you are looking for.
I've seen instances where it actually works, even the F5 key doesn't work? Try this, ctrl>alt>delete then go to task manager, processes tab...end explorer.exe. Then click on file new task and type explorer.exe, then check...does that work?
Windows XP
Right click on the taskbar
Properties menu option
Start Menu tab
Customize button
Programs pane
Clear List
Click on OK
This calls a Windows API function that refreshes the explorere.exe taskbar process and also clears the list (no need for registry edits).
As far as I know, it relies on the explorer.exe process that hosts the start menu/taskbar/desktop being closed and reopened. There is no "clean" way to do this that I am aware of.
If you really need to do this without user interaction, you need to close all explorer.exe processes and relaunch one.
Here's a rudimentary C# program to do that;
using System.Diagnostics;
Process[] procs = Process.GetProcessesByName("explorer");
foreach (Process proc in procs)
{
proc.Kill();
}
Process.Start("explorer.exe");
Note that this will close all "Windows Explorer" windows open, and may or may not open an additional "Windows Explorer" afterwards.
I just tested that on Windows XP 32bit, and it did indeed clear the Run command cache.
HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Explorer\ RunMRU\

Resources