Hot answers tagged

84

Congratulations! You've come up against a problem that has stumped many a Windows user/admin. No, you cannot rename a task except for exporting, renaming and importing again. Yes, it's rather silly. Perhaps an enterprising scripter could create a simple PowerShell script that automates this, but until then, you're stuck with your export/import two-step. ...


12

I believe that return code is a generic .NET console app crashed code. The way the job is set up in Task Scheduler is not causing this issue. Check the Application event log on the server for any errors that occurred near the time the job 'completed'. Those events should give you more information as to why the job exited abnormally, so you have some idea ...


12

I have no authoritative reference but I have just tested the behavior of multiple different Stop conditions in Task Scheduler on both Windows 8.1, Server 2008 R2 and 2012 R2. They both apply! Whichever stop condition is met first, stops the task The "Stop task if it runs longer than"-condition speficied in the Trigger, will only apply when the task has ...


7

It's not ideal, but you could have a separate task that just writes the username to a log file at the same time, and correlate the logs later. For that matter, since the task runs at login, this information is already available in the event logs. If you're really desparate to not correlate these later, you could add code (or a step) to the existing task to ...


6

This is a neat idea. I would write this for you in Powershell or C#, in a few hours, for a very modest fee. ;) Just kidding. How about this... Use Task Scheduler to create two tasks. Each task will be triggered on an Event Log event. Task number one will trigger based on the "AC power is gone" event, and it would execute an action like shutdown /s /t ...


6

I found an action in the WHS task scheduler to "export task". Select the task and on the lower right of the window the export task option shows up. It will save a files as .xml. You can copy that xml file to another machine and use the "action" menu to "import" task. I am about to test this process.


6

You can certainly do this using Powershell and WMI Events. Here's a link that describes setting up PowerShell to monitor events. http://www.pavleck.net/powershell-cookbook/ch31.html (Wayback Link, as it appeared 5 Nov 2013) Here's a link that describes the kind of events you'll be looking for: ...


6

I'd highly suggest not doing this. If your server is so heavily loaded that apache isn't getting the CPU time it needs, then renicing a process will have a very minimal effect, if any. Additionally, apache will have many different processes running at any one time. You could renice the parent process, and its children will inherit the parent's niceness, but ...


5

you have two options for running this task one is if somebodies logged in and one is run whether somebodys logged in or not. I'd just switch the task to must be logged in for debugging then switch it back to the later for normal use.


5

I believe you're looking for cron.


5

It sounds like the task might not be completing successfully, and multiple instances of the task might be trying to run at the same time. Open up Scheduled Tasks from the Control Panel. Right click on the task you've created and click "Properties." Navigate to the "Schedule" tab. Choose the start time (00:10 AM) Make sure that Schedule Task Daily is set ...


5

Proper scheduling of future tasks by local time, taking into account time zones and daylight saving time, is a very complex subject. I've written about it before from a programming perspective on Stack Overflow here and here. I'll summarize from a non-programming perspective: Define your recurrence patterns by local time - not UTC. For example, if you ...


5

Nope. Microsoft built a better mousetrap and you will need to start using it. schtasks.exe replaces at.exe. at.exe is deprecated. From here: Schtasks replaces At.exe, a tool included in previous versions of Windows. Although At.exe is still included in the Windows Server 2003 family, schtasks is the recommended command-line task scheduling tool And ...


5

Server 2012 R2 and Windows 8.1 have Task Scheduler cmdlets, and this module can be copied and used on a Windows 7 machine, presumably it probably needs the latest .NET and the Windows Management Framework as well. I'm able to disable and re-enable scheduled tasks, as well as display task information. Currently I don't know of built-in cmdlets that give me ...


5

I'm guessing this script isn't signed. Have you enabled execution of unsigned scripts using the Set-ExecutionPolicy -ExecutionPolicy Unrestricted cmdlet?


5

First, let me tell you how you would run the script from a task: Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Add arguments (optional): -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'; &'Z:\Exchange ...


4

This could be cleaned up a bit (i.e. mapping LastRunResult codes). Let me know if you need help. Triggers are a bit more difficult since I don't think the plain English representation you see when viewing a task in the GUI exists in the COM object. I believe it would have to be built from the TriggerCollection stored in RegisteredTask.Definition.Triggers ...


4

Go into Task Scheduler (taskschd.msc). While there, there's a button on the right menu for Display All Running Tasks. I think this is what you want. While you're there, you should turn on Enable All Tasks History, so you could track something like this better in the future.


4

On Linux, this can be achieved with xargs: cat cmds | xargs -n 1 -P 6 -0 bash -c where cmds is a list of commands to execute using bash On Windows I suggest you try to solve this with PowerShell. There are multiple questions on this topic over at stack overflow


4

Cygwin's run.exe is intended for this job. See man run.


4

For SQL Server (or in fact any Windows service) you can use the net stop <Service Name> and net start <Service Name> to stop/start the service. The service name you must use is not the display name, it's the actual name. To get that, go to the services control panel and view the service properties. It is the highlighted section on the ...


4

For this you'll probably need a twofer. A schedule task in the OS firing off shutdown /h /t 2 at your scheduled time. One of the following: A BIOS timer to turn on your server. Leverage Wake-on-LAN and issue a Wakeup packet at the exact time you want that server powered back on.


3

You may want to do a logon script. Startup scripts are run by the system when it boots up. Logon scripts are run in userland when the user logs on.


3

Not the best way but can be a life saver. Tasks are stored in C:\Windows\System32\Tasks in XML format importable using schtasks.exe. As Weasly told, renaming the file doesn't work but Create/Delete will. That said, you need the running user password (that you have) Compared to Weasly's suggestion, it just skips the export phase. create a second task ...


3

There is a known bug with task scheduler that will cause it to run the same task twice from time to time. It happens when the previous scheduled task terminates exactly when the new task is supposed to start: the scheduler will then run the same task twice. There is a hotfix available there: http://support.microsoft.com/kb/2461249 When we ran into that ...


3

In a batch file: net stop service4 net stop service3 net stop service2 net start service2 net start service3 net start service4 Assuming you are using xp/2003 or above you could create a scheduled task to run the batch file. Assuming you want to repeat the task every 8 hours, pick a time for it to run, then on the properties of the scheduled task, ...


3

The only way to accomplish this is a bit of a workaround (in my opinion). You will need to create two actions for your task. The steps are as follows: Event is triggered The first action runs a query for the event details you're interested in and saves them to a file. The second action attaches the event details saved in Step 2 to an e-mail and sends it ...


3

That is not the only way to accomplish it. There's actually a much better way that works in windows server 2008 at the very least: http://www.buit.org/2009/07/16/event-based-triggered-tasks/ To summarize, you need to export the task definition to xml, add some xpath queries for the data you want in a text editor, update your commandline, and then import ...


3

Looks like your scheduled task user account doesn't have rights to write to \\igweb01\c$\sqlbackup and \\igsrv01\d$\sql backup.


3

One thing to note is where the script is running from. If you have a patch file that say references "test.log", running the batch directly from c:\logs will have no problems. But when task scheduler runs it it wont know where to find "test.log". So make sure that you either use full paths in your code, or you use the "Run in" function of task scheduler.



Only top voted, non community-wiki answers of a minimum length are eligible