Check tasksched fixes misc#393
Merged
Merged
Conversation
call Get-ScheduledTaskInfo once using $tasks array, and save its results into a map. this is faster than calling it for each element in $tasks use a typed list for saving results. adding to this list is faster than calling += on a default array repedately
hideWindow: true was set when creating a new powershell process. this process inherited the parents console. when running snclient on windows terminal, it would minimize it. when running snclient on conhost/powershell, it would close it. I am unsure why. when running through a vscode terminal, it would be uneffected. I am still unsure why. adding windows.CREATE_NO_WINDOW, stops the inheritance of the console window and these side effects. stdout/stderr piping still works.
the blacklist is taken from the error you get when creating a new task with illegal characters on task scheduler
…Get-ScheduledTask in the scheduled task discovery script Get-ScheduledTask would import the module, and importing a module can be intercepted by antivirus. This took around 20 seconds in each call on some machines. Do away with the module imports completely, use the deeper APIs of COM objects.
sni
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix problem where calling snclient run check_tasksched caused the windows terminal / powershell to hide or close. This was due to hideWindow being true without using the task creation option NO_WINDOW.
Use blacklists instead of whitelists when specifying title and folder arguments. These blacklists are taken from task scheduler directly. This is a better approach, and works with CJK characters as well, windows does allow them in task scheduler paths.
This works alongside earlier changes to powershell command runner, which does not accept parameter definitions that contain single or double quoutes. While they are allowed in the task folder paths, they are a security issue if let through.
Rewrite the scheduling script using deepseek-v4-pro. Instead of using Get-ScheduleTasks which imports a module, use the Schedule.Service COM api. This was required due to some systems blocking/delaying powershell module imports up to 20 seconds.
This delay was reproducible in the affected machines, and happened on each run if powershell.exe was started separately to run the script. When the script was called from an existing powershell terminal, it did not happen. This was most likely caused by antivirus software, which selectively checks the imported modules, but not fully confirmed.