Member-only story
Mastering DSC V3 Adapter series: Expanding WMI Resource (Part Two)
Welcome back to this installment on Mastering DSC V3 Adapter series. The first part covered the original design of the WMI adapter and it’s essentials.
Now, in part two, we dive deeper into enhancing the WMI adapter by expanding its capabilities. This installment will guide you through the process by learning how you can:
- Create PowerShell module
- Develop the
set
capability
Let’s elevate your DSC v3 adapter knowledge by building a new PowerShell module step-by-step, storing the logic for:
- Logging message
- Validating input
- Invoke WMI methods
If you are not a member of Medium, you can view a full version with this link.
Prerequisites
- Cloned DSC project on your local machine
Step 1 — Building logging
Most of the adapters logic has been wrapped around the wmi.resource.ps1
script file. While you can have all the logic run inside this script file, it makes more sense to move the logic to a PowerShell module file (.psm1
).
Storing everything into a single .psm1
file, helps to bring in more re-usability across capabilities you want to expose incrementally.
Time to build the PowerShell module file. Firstly, we want to create a logging function that allows to…