Skip to content

Check tasksched fixes misc 2#394

Open
inqrphl wants to merge 8 commits into
mainfrom
check-tasksched-fixes-misc-2
Open

Check tasksched fixes misc 2#394
inqrphl wants to merge 8 commits into
mainfrom
check-tasksched-fixes-misc-2

Conversation

@inqrphl

@inqrphl inqrphl commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

add hidden argument to check, this is used while discovering tasks in the embedded powershell script directly.

remove parameter/arg , powershell version, timer calls stderr print calls in the embedded powershell script

add logic to remove trailing backslash in the folder path, is only removed if its not root path . this is needed due to new script using scheduler.service com tasks

change the working_dir attribute to working_directory to match with existing check definitions

split up the addTasks function since it was getting too long, and had logical parts to be split

add default values of arguments to the attribute descriptions

regenerate docs

fix has_run attribute, now correctly checks if its not the default last_run_time

add UBool unit type to attributes, add converted for common boolean specifications

the converter looks for common booleanish strings like 'yes' , 'off' 'disabled' 'True' etc, and converts them to 'true' or 'false' . these are then string-compared to the values the check returns for these attributes. it also reports invalid UBool atribute definitions:

PS C:\Users\sorus\repositories\snclient> .\snclient.windows.amd64.exe -vvv --logfile stdout run check_tasksched folder="\Microsoft\" recursive="true" hidden="true" filter='enabled eq 0 and has_run eq FaLSsssSSSsseEE' show-all
UNKNOWN - invalid boolean value: attribute of type bool can not be parsed: 'FaLSsssSSSsseEE' needs to be one of '0 false disabled no n off f' or '1 true enabled yes y on t'

use the Ubool attribute type on check_tasksched attributes: enabled, has_run and hidden. it is not used anywhere else

inqrphl and others added 6 commits June 23, 2026 13:16
add hidden argument to check, this is used while discovering tasks in the embedded powershell script directly.

add debug to stderr calls for the folder,title, recursive and hidden parameters/args in the script

add logic to remove trailing backslash in the folder path, is only removed if its not root path . this is needed due to new script using scheduler.service com tasks

change the working_dir attribute to working_directory to match with existing check definitions
…tting specifications

the converter looks for common booleanish strings like 'yes' , 'off'  'disabled' 'True' etc, and converts them to 'true' or 'false' . these are then string-compared to the values the check returns for these attributes.

use the Ubool attribute type on check_tasksched attributes: enabled, has_run and hidden. it is not used anywhere else
hidden arg is default false in the script as well

fix some other typos/dead code
update docs

split up the addTasks function since it was getting too long, and had logical parts to be split

others are spacing, linting fixes from golangci-lint
in reality, last run time is always not empty and has some default value
@lgmu

lgmu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Output suggestion:

UNKNOWN - ParseAndReplaceBoolAttributes failed: invalid boolean value 'TRUE' (expected one of: 0/1, false/true, disabled/enabled, no/yes, n/y, off/on, f/t)

Also all values should be case-insensitive .

@inqrphl

inqrphl commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Output suggestion:

UNKNOWN - ParseAndReplaceBoolAttributes failed: invalid boolean value 'TRUE' (expected one of: 0/1, false/true, disabled/enabled, no/yes, n/y, off/on, f/t)

Also all values should be case-insensitive .

Case insensitive regex is easy, but grouping the valid values in false/true meanings is a bit hard. I generate those messages by joining valid strings, and they are distinct in truthy falsey groups, and not zipped together

@lgmu

lgmu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Looks good to me now.

check_tasksched "title=Secure-Boot-Update" "folder=Microsoft\Windows\PI" "filter=enabled = True"
WARNING - \Microsoft\Windows\PI\Secure-Boot-Update (2026-06-23 14:41:26 CEST) exited with 2147942401

check_tasksched "title=Secure-Boot-Update" "folder=Microsoft\Windows\PI" "filter=enabled = TRUZE"
UNKNOWN - invalid boolean value: attribute of type bool can not be parsed: 'TRUZE' needs to be one of '0 false disabled no n off f' or '1 true enabled yes y on t'

@lgmu lgmu requested a review from sni June 23, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants