Value Mismatch - Need relevance assistance

When I tried to check whether my “WindowEnd” in the registry equals to system time , then result is “False”

Q: ((((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) = (((two digit hour of it & “” & two digit minute of it) of current time_of_day)))
A: False
T: 73580

The same stuff , when I tried with exists. I am getting “True” instead of “False” , where exactly problem ?

Q: (exists((((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) = (((two digit hour of it & “” & two digit minute of it) of current time_of_day))))
A: True
T: 3324

==

“Exists” returns true because the whole object specified between the parenthesis actually exists.
The first relevance returns false because the value in the registry (in the format hhmm, e.g. 1145) must match to the minute with the current time of day to return true.

1 Like

Got you . I would like to pass the relevance only when match the value (=) with system time .

I have larger condition checking where I have use this statement as well. Do we have any different possibility ?

I don’t think you really want it to match only when the end time is equal. Otherwise, your relevance would evaluate False at 11:44, True at 11:45, and thrn False again at 11:46.

I think what you want is (start time is equal to or greater than ‘now’) AND (end time is equal to or pess than ‘now’)
You’ll still have complications when your windows rolls over the midnight hour.

I have written as follows. Even the “WindowEnd” matches with “system current time” , it’s not coming applicable list . Mean “yes” . Always says “No” :slight_smile:

(if (name of operating system as lowercase does not start with “win” ) then “not managed” else (if (not exists key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” whose (exists substrings separated by “,” whose (exists (it as month) OR it as lowercase = “all”) of (value “Months” of it as string) AND exists substrings separated by “,” whose (it as integer < 5 and it as integer > 0) of (value “Week” of it as string) AND exists substrings separated by “,” whose (exists day_of_week (it)) of (value “DayAlpha” of it as string) AND conjunction of (exists time_of_day ((preceding text of it & “:” & it) of last 2 of it)) of (value “WindowStart” of it as string; value “WindowEnd” of it as string)) of native registry) then “not defined” else (if (disjunction of (((it as lowercase = “all” or it as month = current month) of item 0 of it) AND (it as integer - 1 = (current day_of_month as integer - 1) / 7) of item 1 of it AND (if (item 3 of it < item 4 of it) then (day_of_week (item 2 of it) = current day_of_week AND time of current time_of_day >= item 3 of it AND time of current time_of_day < item 4 of it) else ((day_of_week (item 2 of it) = current day_of_week AND time of current time_of_day >= item 3 of it) OR (day_of_week (item 2 of it) + day = current day_of_week AND time of current time_of_day < item 4 of it)))) of (substrings separated by “,” whose (exists (it as month) or it as lowercase = “all”) of (value “Months” of it as string) , substrings separated by “,” whose (exists (it as integer)) of (value “Week” of it as string) , substrings separated by “,” whose (exists day_of_week (it)) of (value “DayAlpha” of it as string) , (time_of_day ((preceding text of it & “:” & it) of last 2 of it)) of (value “WindowStart” of it as string) , (time_of_day ((preceding text of it & “:” & it) of last 2 of it)) of (value “WindowEnd” of it as string)) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) AND (((((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) = (((two digit hour of it & “” & two digit minute of it) of current time_of_day)))) then “Yes” else “No”)))

Even grater then qual also tried Jason . Not working. Somewhere something is messup . Can you help me here . I have shared my complete code above . Thanks .

My goal : This relevance has to applicable when the server local time equals with “WindowEnd” time in windows registry

I have Marked my script in red which does in last ( see above)

Any luck here :cold_sweat:

I’m sorry, you have several different threads open on this same topic and the titles aren’t helping me to find this, as the topics are mostly “Relevance Assistance Needed” or “Day Filter” or things like that.

Exactly what do you have as far as registry key value names, and what are the expected values for each? I think your relevance statement above is more complex than necessary but I can’t find the actual values you’re trying to parse at this point.

Example:
HKLM\Software\CRQ\PatchWindow
Month: Jan, Feb, Mar,…AllMonths
Day: Mon, Tue, Wed

I think Jason was headed the right direction in his question.

You want to make sure that the current time is Greater than the Start Time and Less than the End Time.

That should already be taken care of in this section:

(if (item 3 of it < item 4 of it) then (day_of_week (item 2 of it) = current day_of_week AND time of current time_of_day >= item 3 of it AND time of current time_of_day < item 4 of it) else ((day_of_week (item 2 of it) = current day_of_week AND time of current time_of_day >= item 3 of it) OR (day_of_week (item 2 of it) + day = current day_of_week AND time of current time_of_day < item 4 of it)))

Yes Brolly. you are correct .Changed something here and testing . Thanks .

I written this way. However failing to come applicable during the end of “WindowEnd”. As I pointed , I am trying to match with “WindowEnd” time equals with system time & when it happen , it has to show “Yes”

(
if
(
name of operating system as lowercase does not start with “win”
)
then
"not managed"
else
(
if
(
not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot"
whose
(
exists substrings separated by ","
whose
(
exists
(
it as month
)
OR
it as lowercase = “all”
)
of
(
value “Months” of it as string
)
AND
exists substrings separated by ","
whose
(
it as integer < 5
and
it as integer > 0
)
of
(
value “Week” of it as string
)
AND
exists substrings separated by ","
whose
(
exists day_of_week
(
it
)
)
of
(
value “DayAlpha” of it as string
)
AND
conjunction of
(
exists time_of_day
(
(
preceding text of it & “:” & it
)
of last 2 of it
)
)
of
(
value “WindowStart” of it as string; value “WindowEnd” of it as string
)
)
of native registry
)
then
"not defined"
else
(
if
(
disjunction of
(
(
(
it as lowercase = "all"
or
it as month = current month
)
of item 0 of it
)
AND
(
it as integer - 1 =
(
current day_of_month as integer - 1
)
/ 7
)
of item 1 of it
AND
(
if
(
item 3 of it < item 4 of it
)
then
(
day_of_week
(
item 2 of it
)
= current day_of_week
AND
time of current time_of_day >= item 3 of it
AND
time of current time_of_day < item 4 of it
)
else
(
(
day_of_week
(
item 2 of it
)
= current day_of_week
AND
time of current time_of_day >= item 3 of it
)
OR
(
day_of_week
(
item 2 of it
)
+ day = current day_of_week
AND
time of current time_of_day < item 4 of it
)
)
)
)
of
(
substrings separated by ","
whose
(
exists
(
it as month
)
or
it as lowercase = “all”
)
of
(
value “Months” of it as string
)
, substrings separated by ","
whose
(
exists
(
it as integer
)
)
of
(
value “Week” of it as string
)
, substrings separated by ",“
whose
(
exists day_of_week
(
it
)
)
of
(
value “DayAlpha” of it as string
)
,
(
time_of_day
(
(
preceding text of it & “:” & it
)
of last 2 of it
)
)
of
(
value “WindowStart” of it as string
)
,
(
time_of_day
(
(
preceding text of it & “:” & it
)
of last 2 of it
)
)
of
(
value “WindowEnd” of it as string
)
)
of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry
)
AND
(
(
(
(
last 4 of
(
“0000” &
(
(
it / 60
)
as string & last 2 of
(
“00” &
(
(
it mod 60
)
as string
)
)
)
of
(
first 2 of it as integer * 60 + last 2 of it as integer
)
of it
)
of
(
(
value “WindowEnd” of it as string
)
of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry
)
as string
)
)
)
>=
(
(
(
two digit hour of it & “” & two digit minute of it
)
of current time_of_day
)
)
)
then
"yes"
else
"no”
)
)
)

In the future, I would recommend you enclose any snippets of relevance in the tic marks (back-quote). This prevents the introduction of “Smart Quotes” in your post. You can do so by choosing the Preformatted text button (</>). Also, it would help everyone help you, if you would post samples of your registry values.

So, if I understand your business logic, the relevance should evaluate to “yes” when the following conditions are met:

  1. Current time of the client is inside the time period represented by the content of the registry values WindowStart & WindowEnd:

Test for start of Window: ... time current_time_of_day >= item 3 of it ...
Test for end of Window test: ... time current_time_of_day < item 4 of it ...

These comparisons will be made using hh:mm:ss

  1. You also check when the combination of month names, week numbers (1-4), and day names present in other registry values match the current date.

  2. You check again to see if the current time is before the end of the window. It appears to me that this last test is redundant and overly complicated, since it uses hh:mm, and ignores seconds.

What business rule are you implementing with this code? Do you meet your requirements still if you remove test 3?

I have other questions about the complexity of your relevance, but let’s stick to the issue you raised above.

Yes. Your understanding about business requirement is correct. Last item , I removed seconds , reason as follows . My registry having the following format as example .

As per below pic , my WindowStart time is 04am 30 mins ( 24 clock format ) . Hence no need seconds in place . Similar way of WindowEnd as well .

1

As you suggested , let me make it straight forward by removing item 3 and let me test gain .