124 votes
Accepted

How to monitor a folder and trigger a command-line action when a file is created or edited?

At work we use Powershell to monitor folders. It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools. This script monitors a certain folder and writes a ...
user avatar
  • 26.2k
66 votes
Accepted

Schedule a task with admin privileges without a user prompt in windows 7

Open Task Scheduler Create a new task In the "General" tab - ensure the following settings are entered: "Run whether user is logged on or not" "Run with highest privileges" "Configure For" (your ...
user avatar
  • 12.2k
37 votes
Accepted

How can I copy a scheduled task from a dead Windows to new Windows

There are two directories within which you might find a scheduled task definition or log: c:\windows\tasks c:\windows\system32\tasks That said, depending on the task, you may or may not have ...
user avatar
  • 33.6k
24 votes

Using Task Scheduler to Run a Task Before Shutdown

Even though this is an older thread, I'd like to add a solution I devised that works well. I wanted to run a script or batch file whenever a shutdown or restart was initiated, but I didn't want to ...
user avatar
  • 241
22 votes
Accepted

Starting scheduled task by detecting connection of USB device

The thread Task Scheduler: How to automatically synchronize my USB flash drive? has this answer by a user called monotone, which uses PowerShell together with the Task Scheduler : I had the same ...
user avatar
  • 411k
19 votes

How can I copy a scheduled task from a dead Windows to new Windows

Tasks are normally stored in C:\Windows\System32\Tasks (as xml files). You should be able to import from there
user avatar
  • 6,942
18 votes
Accepted

Windows 7 Task Scheduler is giving me an error saying "The specified account name is not valid"?

The issue was after changing my PC name, tasks I had created in Task Manager still had the User in Security Options set to the old PC name. The way to fix this was for every task: Task Manager > ...
user avatar
  • 430
13 votes
Accepted

Windows 10: Scheduled tasks with workstation lock/unlock not being triggered

Follow the below steps to troubleshoot and resolve your problem Task Scheduler Properties. . . From Windows Task Scheduler on the job properties (see bottom most screen shots) in the. . . 1. ...
user avatar
13 votes
Accepted

How to fix broken permissions for Windows scheduled task?

All tasks definitions stored in both Registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\* and Filesystem: C:\Windows\System32\Tasks\* Security ...
user avatar
  • 146
12 votes
Accepted

How to stop Windows 10 from autostarting apps?

Go to Start then Settings, select Privacy and click on Background apps. From there disable the apps that you don't want running in the background. These apps don't start with Windows, that's why they ...
user avatar
  • 282
10 votes
Accepted

Search Task Scheduler Library

Is there any way to create a filter on Task Scheduler's library pane I don't think it is possible to create a filter in Task Scheduler. However, you can use explorer's search facilities to do the ...
user avatar
  • 144k
10 votes
Accepted

'at' command intended behaviour? Launching each commands instead of scheduling

at reads commands from standard input. What you are doing is running ./tests.o and feeding its output string(s) as command(s) for at to schedule. Also, there is no need for the trailing &, as at ...
user avatar
  • 16.8k
9 votes
Accepted

Powershell script to list scheduled tasks on remote systems

I finally wrote a script that suits my needs. This script will 'scan' all the servers listed in AD, searching in the c:\Windows\System32\tasks folder for xml files. Then it will write the value of the ...
user avatar
  • 1,866
8 votes

How to pass an argument to a Windows Scheduled Task with spaces in it

schtasks.exe /create /SC WEEKLY /D SUN /SD 11/12/2015 /ST 12:00:00 /TN "taskname" /TR "'c:\program files(x86)\task.exe' Arguments" Note the use of ' in the path of a file to be run.
user avatar
8 votes

Trigger Task Scheduler in Windows 7 when computer wakes up from sleep/hibernate

Event 107 when resumed from sleep, and 42 from entering to sleep. I just try event 107 to trigger a program when resume from sleep, and it worked
user avatar
8 votes
Accepted

Slurm jobs are pending, but resources are available

SLURM by default does not allow resources sharing, so when a job runs in 1 node the rest of the jobs wait for it to complete before executing any further jobs on the same node. SLURM needs to be ...
user avatar
8 votes

Multiple odd accounts in Windows 10 Task Scheduler

You won't be able to provide any password there as the user S-1-5-18 is a system account. The PSExec tool from SysInternals can work around this issue by launching Task Scheduler as SYSTEM. Run this ...
user avatar
  • 463
7 votes

Task Scheduler won't wake the computer

If you are putting your computer to sleep with the commonly used batch script command Rundll32.exe Powrprof.dll,SetSuspendState Sleep then the scheduled task will not be able to wake the computer from ...
user avatar
  • 129
7 votes
Accepted

How to disable a windows schedule task in Windows 10 using the utility schtasks?

Use Powershell! Disable-ScheduledTask -TaskName "Adobe Flash Player Update" TaskPath TaskName State -------- ...
user avatar
  • 1,136
7 votes

Use Windows Task Scheduler To Put Windows To Sleep Without Batch File

Set up your time in Task Scheduler's Triggers window as normal. On the General tab, it's probably easiest to make the task run as SYSTEM, and run whether the user is logged in or not. Highest ...
user avatar
  • 38.7k
6 votes

Powershell script to list scheduled tasks on remote systems

Hey thought I'd share a modified version of the script posted by Ob1lan. The modification helps find tasks in nested folders and lists the status of the task as well as details included in the ...
user avatar
  • 99
6 votes

Windows 10: Scheduled tasks with workstation lock/unlock not being triggered

I solved this by bypassing the "On Workstation Lock/Unlock" trigger types, and setting triggers to look at the windows event log directly. It's not ideal, but should be sustainable. Definitely still ...
user avatar
  • 169
6 votes
Accepted

Updating a scheduled task with 'repeat every x hours' causes it to be triggered on Windows 10

Prevent a Task Scheduler Task from Executing on Setting Updates Set the Edit Trigger to run at an interval of One Time and then in Advanced settings section, select Repeat task every 4 hour with for ...
user avatar
5 votes

How to monitor a folder and trigger a command-line action when a file is created or edited?

If the action is just to copy changed files, you can use robocopy /MON:1 I don't know if robocopy uses FileSystemWatcher or works by polling for changes.
user avatar
  • 441
5 votes

Windows Task Scheduler: Schedule task to run once every 10 seconds

It's silly windows doesn't have this functionality built into Task Scheduler. However, it can be easily worked around with a simple powershell script. $i = 0 for ($i=0; $i -le 4) Start-Service -...
user avatar
  • 150
5 votes

Simple Linux-based task scheduler with job dependencies?

These look interesting: https://airflow.incubator.apache.org/ not so simple but powerful and supported by apache, configured by code, widely used now https://www.digdag.io/ java airflow like, ...
user avatar
5 votes

Creating Task With a Batch File - run task as soon as possible if missed

Powershell to rescue, use -StartWhenAvailable Set-ScheduledTask ` -TaskName $TaskName ` -TaskPath $TaskPath ` -Trigger $(New-ScheduledTaskTrigger -At "01.01.2018 05:00:00" -DaysOfWeek $...
user avatar
5 votes

Windows scheduler that runs every x minutes daily on the command line

Is there a way to schedule a task that runs every 5 minutes daily? You can do this with the following command: schtasks /create /tn "MyTask" /sc minute /mo 5 /tr "MyTask.cmd" Explanation: /...
user avatar
  • 144k
5 votes
Accepted

Hyper-Threading (SMT) Affinity and Equality

Are both threads on a physical CPU treated equally? Yes. There is no preference in allocation of the core's execution resources to one thread or the other. (What's an "execution resource"? See the ...
user avatar
5 votes

How to run very long ansible tasks?

For a long running task use Ansible's Asynchronous mode to effectively background the task. - name: 'YUM - fire and forget task' yum: name=docker-io state=installed async: 1000 poll: 0 ...
user avatar

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