Skip to main content

Desktop Fileset Timed Events

Description

Filesets have the option to set an activation time, but what about items based upon timing of day, for example, rather than a dedicated date.

image.png

Policy Blocker Scripts are really designed to pause management of clients.   However, with some clever use, a Policy Blocker Script can provide us with some assistance.   This script type runs every 5 minutes on clients.   Although the intention is to pause management until the script reports an exit status of 0, the 5 minute continual trigger can be leveraged.

Extending this with Custom Fields, it is possible to build out a desired outcome.

Ingredients

macOS Windows
Policy - Timed Event macOS.fileset.zip Policy - Timed Event Windows.fileset.zip

Directions

  • Download and import the provided Custom Fields
  • Download and import the appropriate Fileset(s) (macOS and/or Windows)

Alter the Custom Fields values for Inactive and Active times to suit.   Time is set using hours, minutes and seconds.   E.g.

Desired Time (HH:MM) Custom Field Value (HHMMSS not including leading zeros)
09:30 93000
12:55 125500
18:00 180000

If changing the Custom Field value for a device which is already running the policy, 2 subsequent Model Updates will need to be received by the client, if looking for a more ‘immediate’ result.   The blocker script holds the client until success.   This means, during a Model Update, the blocker will run before the new Custom Field Value will be read by the device.   As such, only after a subsequent update (or inventory) will the blocker script be aware of the new Custom Field value.   Custom Fields will naturally update on devices with inventory, but this is less frequent.

Time Order

Times can be either way around.  

Examples:

Consider working hours to begin at 08:30 and end at 18:00

Example 1

An item should only be considered outside of standard working hours.

  • Disable Active Time: 83000
  • Enable Active Time: 180000

image.png

Example 2

Alternatively, an item should be considered during working hours:

  • Enable Active Time: 83000
  • Disable Active Time: 180000

image.png

Imported Custom Fields are disabled for all devices by default.  Once tested, consider using the option to assign to all devices for each Custom Field imported.  The file provided contains all 3 Custom Fields.

image.png

Smart Groups

A third Custom Field holds a true/false value.   This value may be used with a Smart Group query, to determine if an item should be associated at this time or not.

This Custom Field is set to use custom_bool_01.   If this is already in use, an alternate Custom Bool number should be utilised instead.   This is editable through the Scripts Environment Variables.  

The script uses the following method to set these values.

https://kb.filewave.com/books/custom-fields/page/add-filewave-custom-inventory-fields-remotely-using-a-fileset

Example

An update to Firefox needs to occur after 17:00 or before 09:30

  • Disable Active Time = 93000
  • Enable Active Time = 170000

Between these times, the 3rd Custom Field ‘Active Time’ should be False/0.   Outside of these times, the ‘Active Time’ Custom Field should be True/1.   

image.png

Smart Group can be based upon the following:

  • Is Active Time True/1
  • Is the version of Firefox matching that within the Fileset

Do not just use the active time, unless intentional.   Devices will continually enter and leave the Smart Group if this is set to only use the Active Time, each day.   If an item is associated in this way, associated Filesets will trigger every time the device enters the group.

Deeper Dive

The Policy Blocker script has 2 considerations initially:

  • The hours between which the timed event should occur
  • The current time

This means there is a time beyond which the desired action may occur and a time beyond which the action should not occur and this needs to be compared with the current time.

The enable/disable active times are provided by way of Executable Environments.   Taking this a step further, these times are defined using Administrator Custom Fields.   This way the times can more easily be altered if required.

A third Custom Field is being used to indicate if the current time is one of activity allowance or not, but this time a Client Command Line Custom Field.

Client Command Line Custom Fields are stored locally on the device and then this value is available to the server, both for visibility, but can also be used in queries, for Smart Groups.

image.png

Client Command Liine Custom Fields may be altered in FileWave Central Admin App, however, as soon as the device checks back inventory, the value from the client will be pushed back to the server.