In release 0.25.0 we released Maintenance Tasks. Inspired by PowerShell’s Desired State Configuration, Maintenance Tasks allow you control non-Software aspects of a machine.
We created a Maintenance Task that controls Power Options on Windows
Each parameter is serialized and created as a proper variable in your PowerShell script.
A proper Maintenance Task has 3 functions: Get, Set, and Test which correlate to the Monitor, Enforce and Audit modes.
If you only provide a Get script, the Maintenance Task is conceptually a “Monitor” for gathering data.
If you only provide a Set script, the Maintenance Task is conceptually “Fire-and-Forget” and only serves to provide a mechanism for bundling parameters to your script.
The scripts can be separate
Or the scripts can be all together.
When this option is selected, we provide a $Method variable containing “get”, “set”, or “test”. This encourages code re-use as the logic in the Get script is often needed in the Test script.
For the purposes of enforcement, the Get script isn’t necessary. The Test script returns a boolean indicating whether the settings are in compliance (given the parameters).
If deployed in Enforce mode, the Set script will be run, which when implemented correctly, will correct the deviation.