Hot answers tagged

92

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. ...


13

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. Per trigger stop condition: The Stop task if it runs longer than-condition specified in the Trigger will only ...


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 ...


7

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.


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

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: http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/04/...


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 ...


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 ...


5

I believe you're looking for cron.


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

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

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 Powershell\...


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 ...


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 screenshot:...


4

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


4

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 ...


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.


4

Copy the .job file(s) from C:\Windows\Tasks from one computer to the next. Note: I'm not sure if these files are compatible from one version of Windows to the next, but they exist in XP/2003/Vista/7/2008/R2...


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

You can try this: schtasks /create /tn "Task Name" /tr <path to script> /sc minute /mo 10 This task will run every 10 minutes, the first time is right after you make this command.


4

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 ...


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.


3

It's called crontab (click the name for a informative help page over at Ubuntu)


3

It sounds like you want to redirect the output of the command called from within the .bat file. Example.bat dir \ > Example_output.txt 2>&1 In this case, Example.bat runs a "dir" command on the "\" root directory, and the ">" sends the output of that dir to the file Example_output.txt. The 2>&1 modifies the redirection to include both ...


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.


3

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


3

Unfortunately not. That's the way this is done now. I believe it's for security purposes, so that set tasks cannot be modified while they are actually setup and enabled.



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