PowerShell / DSC

This repo is for the DSC v3 project
MIT License
201 stars 29 forks source link

WMI resource provider #279

Closed anmenaga closed 10 months ago

anmenaga commented 10 months ago

PR Summary

Fix #263

Prototype of a resource provider to read data from WMI.

PR Context

Supported operations: dsc resource list, dsc resource get, dsc config get. Export will be easy to add once #183 is closed. This resource provider uses Windows PowerShell and CimCmdlets PS module. Initially tried using WMI-rs crate, but it didn't work out because looks like it does not return some required class metadata.

Example:

PS C:\DSCv3> dsc resource list *BIOS
Type                         Version  Requires      Description
---------------------------------------------------------------
root\cimv2/Win32_BIOS                 DSC/WMIGroup
root\cimv2/Win32_SystemBIOS           DSC/WMIGroup

PS C:\DSCv3> dsc resource get -r root\cimv2/Win32_BIOS
actualState:
  EmbeddedControllerMinorVersion: 255
  BuildNumber: null
  Description: 1.22.0
  ReleaseDate: /Date(1678924800000)/
  Manufacturer: Dell Inc.
  SoftwareElementID: 1.22.0
...