diff --git a/dsc/examples/osinfo_parameters.dsc.yaml b/dsc/examples/osinfo_parameters.dsc.yaml index 5e6613c5..876b2b71 100644 --- a/dsc/examples/osinfo_parameters.dsc.yaml +++ b/dsc/examples/osinfo_parameters.dsc.yaml @@ -17,3 +17,7 @@ resources: type: Microsoft/OSInfo properties: family: macOS +- name: path + type: Test/Echo + properties: + output: "[envvar('PATH')]" diff --git a/dsc/examples/winget.dsc.yaml b/dsc/examples/winget.dsc.yaml new file mode 100644 index 00000000..1a4f8578 --- /dev/null +++ b/dsc/examples/winget.dsc.yaml @@ -0,0 +1,24 @@ +# The `Microsoft.Winget.DSC` resources needs to be installed: install-psresource Microsoft.Winget.DSC -Prerelease + +$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json +parameters: + ensureCalc: + type: string + defaultValue: Present + allowedValues: + - Present + - Absent +resources: +- name: Use class PowerShell resources + type: Microsoft.DSC/PowerShell + properties: + resources: + - name: PowerShell 7 Preview + type: Microsoft.WinGet.DSC/WinGetPackage + properties: + Id: Microsoft.PowerShell.Preview + - name: Calc from Windows Store + type: Microsoft.WinGet.DSC/WinGetPackage + properties: + Id: "9WZDNCRFHVN5" + Ensure: "[parameters('ensureCalc')]" diff --git a/dsc/examples/wmi.dsc.yaml b/dsc/examples/wmi.dsc.yaml new file mode 100644 index 00000000..c4907988 --- /dev/null +++ b/dsc/examples/wmi.dsc.yaml @@ -0,0 +1,10 @@ +$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json +resources: +- name: WMI + type: Microsoft.Windows/WMI + properties: + resources: + - name: computer system + type: root.cimv2/Win32_ComputerSystem + - name: network adapter + type: root.cimv2/Win32_NetworkAdapter diff --git a/wmi-adapter/Tests/wmi.tests.ps1 b/wmi-adapter/Tests/wmi.tests.ps1 index d625fe3c..e5d2115c 100644 --- a/wmi-adapter/Tests/wmi.tests.ps1 +++ b/wmi-adapter/Tests/wmi.tests.ps1 @@ -44,4 +44,14 @@ Describe 'WMI adapter resource tests' { $res.results[0].result.actualState[1].BiosCharacteristics | Should -Not -BeNull $res.results[0].result.actualState[2].NumberOfLogicalProcessors | Should -Not -BeNull } + + It 'Example config works' -Skip:(!$IsWindows) { + $configPath = Join-Path $PSScriptRoot '..\..\dsc\examples\wmi.dsc.yaml' + $r = dsc config get -p $configPath + $LASTEXITCODE | Should -Be 0 + $r | Should -Not -BeNullOrEmpty + $res = $r | ConvertFrom-Json + $res.results[0].result.actualState[0].Model | Should -Not -BeNullOrEmpty + $res.results[0].result.actualState[1].Description | Should -Not -BeNullOrEmpty + } } diff --git a/wmi-adapter/copy_files.txt b/wmi-adapter/copy_files.txt index be7f7e31..a6bfcb39 100644 --- a/wmi-adapter/copy_files.txt +++ b/wmi-adapter/copy_files.txt @@ -1,2 +1,2 @@ wmi.resource.ps1 -wmi.dsc.resource.json.optout \ No newline at end of file +wmi.dsc.resource.json \ No newline at end of file