Skip to content

Commit 8c0f2f0

Browse files
authored
Merge pull request #453 from SteveL-MSFT/psconfeu
Add example configs for winget and wmi
2 parents b0e6ed9 + 773cd8d commit 8c0f2f0

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

dsc/examples/osinfo_parameters.dsc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ resources:
1717
type: Microsoft/OSInfo
1818
properties:
1919
family: macOS
20+
- name: path
21+
type: Test/Echo
22+
properties:
23+
output: "[envvar('PATH')]"

dsc/examples/winget.dsc.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# The `Microsoft.Winget.DSC` resources needs to be installed: install-psresource Microsoft.Winget.DSC -Prerelease
2+
3+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
4+
parameters:
5+
ensureCalc:
6+
type: string
7+
defaultValue: Present
8+
allowedValues:
9+
- Present
10+
- Absent
11+
resources:
12+
- name: Use class PowerShell resources
13+
type: Microsoft.DSC/PowerShell
14+
properties:
15+
resources:
16+
- name: PowerShell 7 Preview
17+
type: Microsoft.WinGet.DSC/WinGetPackage
18+
properties:
19+
Id: Microsoft.PowerShell.Preview
20+
- name: Calc from Windows Store
21+
type: Microsoft.WinGet.DSC/WinGetPackage
22+
properties:
23+
Id: "9WZDNCRFHVN5"
24+
Ensure: "[parameters('ensureCalc')]"

dsc/examples/wmi.dsc.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
2+
resources:
3+
- name: WMI
4+
type: Microsoft.Windows/WMI
5+
properties:
6+
resources:
7+
- name: computer system
8+
type: root.cimv2/Win32_ComputerSystem
9+
- name: network adapter
10+
type: root.cimv2/Win32_NetworkAdapter

wmi-adapter/Tests/wmi.tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@ Describe 'WMI adapter resource tests' {
4444
$res.results[0].result.actualState[1].BiosCharacteristics | Should -Not -BeNull
4545
$res.results[0].result.actualState[2].NumberOfLogicalProcessors | Should -Not -BeNull
4646
}
47+
48+
It 'Example config works' -Skip:(!$IsWindows) {
49+
$configPath = Join-Path $PSScriptRoot '..\..\dsc\examples\wmi.dsc.yaml'
50+
$r = dsc config get -p $configPath
51+
$LASTEXITCODE | Should -Be 0
52+
$r | Should -Not -BeNullOrEmpty
53+
$res = $r | ConvertFrom-Json
54+
$res.results[0].result.actualState[0].Model | Should -Not -BeNullOrEmpty
55+
$res.results[0].result.actualState[1].Description | Should -Not -BeNullOrEmpty
56+
}
4757
}

wmi-adapter/copy_files.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
wmi.resource.ps1
2-
wmi.dsc.resource.json.optout
2+
wmi.dsc.resource.json

0 commit comments

Comments
 (0)