Custom Content Metering

To get started, if you format a date like this... YYYYMMDD, then you can use a greater than, less than or equal to for comparison.

20261013 < 20261014

q: 20261013 < 20261014
A: True
T: 1.094 ms
I: singular boolean

q: 20261013 < 20261001
A: False
T: 0.822 ms
I: singular boolean

q: 20261010 < 20261014
A: True
T: 0.544 ms
I: singular boolean

q: 20261013 < 20270704
A: True
T: 0.273 ms
I: singular boolean

We use this with Java Licensing, to make sure we only patch licensed systems.

With this in mind, once a client obtains the licensing, we verify the license and check expiry dates.

We then have a task that will set the boundaries for deploying our licensed Java baseline.

Note: We have a property that stores a ticket number for actions we take that have a ticket. Those are collected and stored in a DB so we can make another change with a different ticket number later.

Another note, this will have to be updated for 2030+ when the time comes.

// Query for Expirey date
action parameter query "SetExpire" with description "Please enter the Expiry date, in format YYYYMMDD (Ex. 20280125) :" With default ""

//Get the ticket number
action parameter query "SetTicket" with description "Please enter JUST the Ticket Number:" With default ""

//Verify the data entered is valid, 8 digist long (YYYYMMDD) and starts with the year 202?
continue if { exists (parameter "SetExpire" of action) whose (length of it as integer = 8) }
continue if { substring (0,3) of (parameter "SetExpire" of action) = "202" }
continue if { parameter "SetExpire" of action as integer > (year of it as string & month of it as two digits & day_of_month of it as two digits) of current date as integer}

//Now set this in the registry (Licened Java Values) LJV
regset64 "[HKEY_LOCAL_MACHINE\SOFTWARE\MYCO\LJV]" "expirydate"="{parameter "SetExpire" of action}"
setting "MYCO_Licensed-Java"="True" on "{parameter "action issue date" of action}" for client
setting "_BESClient_AllowCustomRepoDownloads"="http://10.11.12.13:52311/Repository/" on "{parameter "action issue date" of action}" for client
setting "MYCO - Tickets"="{parameter "SetTicket" of action} (Enable Licensed Java)" on "{parameter "action issue date" of action}" for client

Then we put this in our licensed java baseline relevance.

(exists setting "MYCO_Licensed-Java" of client) AND (value of setting "MYCO_Licensed-Java" of client as string ="True"| "False")
AND
exists value "expirydate" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\MYCO\LJV" of x64 registries
AND
(value whose (name of it is "expirydate") of key "HKEY_LOCAL_MACHINE\SOFTWARE\MYCO\LJV" of x64 registries as integer) > ((year of it as string & month of it as two digits & day_of_month of it as two digits) of current date as integer)

We have just created a way to meter licensed java by setting a date that the license expires in the registry. I don't have to set a calendar reminder to remove the licensing manually and I can target only licensed systems

2 Likes