Questions tagged [windows-task-scheduler]

Use for questions about programmatic modification of task scheduling on any version of the Windows OS.

The MS Windows system scheduler component manages the execution time (time slices) that competing processes & threads are given on available processor cores.

Tag usage

The task is for questions about programmatic modification of task scheduling on any version of the Windows OS. You should also tag questions with their specific Windows version, where relevant.

Related tags

References

Microsoft documentation is the primary source for documentation about Windows Scheduling. You may refer the following topics for more information:

845 questions
1
vote
1 answer

How to detect the Task Scheduler trying to terminate a program due to the "Stop if the computer switches to battery power" option

Background I am writing a PowerShell script that runs from Windows Task Scheduler and resides in the task tray. Problem When you create a new task in Task Scheduler, the option Start the task only if the computer is on AC power and Stop if the…
SATO Yusuke
  • 1,600
  • 15
  • 39
1
vote
1 answer

Is there any way to get email/whatsapp notification when a scheduled python file in task scheduler fails to execute?

I am currently working on scheduling some python tasks for different purposes, but I want to get notified about the failure of python code execution if it doesn't reach the end of line. I have researched different solutions like, using management…
1
vote
1 answer

Building nanoserver image: task scheduler command fails but succeeds when run from the container command line

I am trying to build a nanoserver image which includes task scheduling in the dockerfile: FROM mcr.microsoft.com/windows/nanoserver:20H2 USER ContainerAdministrator RUN schtasks /create /tn test /tr test /sc weekly /d MON /st 00:00 /ru…
vcattin
  • 687
  • 1
  • 4
  • 15
1
vote
1 answer

Task Scheduler - When the event is added to the event log the created task not running

Here is the code that I used to create task and bind it to event log, after doing some action I can see in event logs that new event log was created, but task not stared, what was done incorrect here ? public void CreateTaskSchedulerTask(Trigger…
1
vote
1 answer

How can I exit console app exe uninterrupted. (The application terminates before the ProcessExit method completes)

I have a .net 5.0 console application. I scheduled that application exe in task scheduler. Sometimes, when I end the task, the application kills without finishing the parts I have coded to finish. (I am stopping some services, and writing things in…
1
vote
1 answer

Trying to start firefox from a batch file (task scheduler) using Windows Powershell, but the window is not appearing

I am trying to run a command in windows powershell that will start a task schedule. Below is the command that I am using: Start-ScheduledTask -TaskName "pkms task scheduler" The powershell can run the task and the batch files from the scheduler but…
1
vote
0 answers

Task Scheduler won't execute a powershell script

I have a powershell script that runs on 1 machines but remotes out to other machines to collect system information. The script works fine when I run it manually, but it will not run as a scheduled task. I have it setup with the action "start a…
1
vote
1 answer

win32com: Task Scheduler: how to "run whether user is logged on or not"

I've been trying to set a python script than will create a Windows Task Schedule based on some parameters. But first, I'm running some tests to be sure that I can set it up in the way it is needed to work. As a base, I've found the question Is there…
brunoto
  • 91
  • 9
1
vote
0 answers

Running a PowerShell script as administrator and minimized

I have set up a task on task scheduler to run a .bat file that runs a PowerShell script as admin which sets the DNS settings. I figured out how to make the .bat file run minimised, but the PowerShell window still pops up. Here is the script for the…
Calmdiddy
  • 25
  • 5
1
vote
0 answers

Unable to run Unregister-ScheduledTask via php

while creating task I used the command $cmd3 = 'Register-ScheduledTask '.$ID.' -Action $action -Trigger $trigger'; $check = Shell_Exec("powershell.exe -executionpolicy bypass -NoProfile -Command " . $cmd3 . ";"); Now, I am trying to delete the task…
1
vote
2 answers

POWERSHELL Task Scheduler passing variables inside -Argument

Good afternoon, I am very new to Powershell and am trying to achieve the following: Loop through a folder directory Set the folder name as a variable Create a Task Pass the variable (declared in Step 2) as the required parameter for the -File…
1
vote
1 answer

Trying to find ways to update the "Description" parameter of an existing task in Taskscheduler from powershell

I am trying to disable a Task from task scheduler on multiple remote servers and while I do that I want to update the description of these tasks as well. Though the command sets to work on schedule tasks are pretty straight forward…
1
vote
0 answers

How do I get Python and Task Scheduler to work on Windows VM when not connected from laptop?

I wrote a script in python to open and run an alteryx workflow, and used Windows task scheduler to automate it daily. It works great when I'm connected to the VM from my laptop. But when I let it run while the VM is disconnected from my laptop, it…
1
vote
0 answers

Task scheduler (Windows) for python code not executing, showing (0*1) error

It works with test.py showing simple print statement BUT not working for below code, how to have this below code executed through scheduler import pywhatkit pywhatkit.sendwhatmsg('+91xxxxxxxxx', 'Good Morning', 18, 18)
Kat
  • 23
  • 4
1
vote
1 answer

How to automate a script in R using taskscheduleR?

I am currently looking at this documentation to automate a script on my machine using R and taskscheduleR. I am confused within this documentation of the following: In the example within the documentation, what is "extdata", is this supposed to be…
Jaskeil
  • 1,044
  • 12
  • 33