Tag Info

Hot answers tagged

58

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


7

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


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

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

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 believe you're looking for cron.


5

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.


5

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


5

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


4

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


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

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.


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

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


4

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


3

There are a lot of monitoring solutions out there. SCOM, OpsView, Nagios, Cacti, Zabbix, etc. Look at them and pick one that suits your needs. If a ping script in a scheduled task meets your needs, then use that. On a side note: You really really shouldn't be running a production server inside of VMWare Workstation as your tags imply. It's a desktop ...


3

One way to accomplish this would be to use psexec like this: psexec /accepteula yourserver.yourdomain CommandToExecuteRemotely An alternative could be to enable PS Remoting on the remote server, then your scheduled task could be of the form powershell -command "Invoke-Command -ComputerName yourserver.yourdomain -FilePath ...


3

Even though the GUI drop down menu only goes down to 5 minutes... just try manually typing in 1 minute.


3

Extending on Ryan's approach using 2 tasks, one triggered by "Power Gone", and an "abort" button task, triggered by a "Power Restore" event In case you need to do something more generic (not every executable has an abort switch like shutdown), and want to maintain a few-minute buffer before you start sending emails to management, wiping disks or ...


3

Changing my answer since you changed the tag from Server 2008 to 2003... and I wasn't really accurate with my first answer. Whatever account is configured to run the scheduled task, a logon session is created for that account every time the task runs, a window station is created for that logon, and the windows are created in that window station/logon ...


3

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.


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.


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



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