Skip to content

Commit 0e878ce

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
add winget example
1 parent 5f891a4 commit 0e878ce

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

dsc/examples/PSConfEU_2024_Demo.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,20 @@ dsc resource get -r Microsoft/osinfo
8484
- WindowsPowerShell
8585
- PowerShell 7
8686

87+
Winget example
88+
8789
### WMI Adapter
8890

8991
### Include Resource
9092

9193
### Parameters
9294

95+
- Winget
96+
97+
```powershell
98+
dsc config -p '{"parameters":{"ensureCalc":"Absent"}}' set -p .\dsc\examples\winget.dsc.yaml
99+
```
100+
93101
- Secure paramters
94102

95103
### Metadata

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
21+
type: Microsoft.WinGet.DSC/WinGetPackage
22+
properties:
23+
Id: Microsoft.WindowsCalculator_8wekyb3d8bbwe
24+
Ensure: "[parameters('ensureCalc')]"

0 commit comments

Comments
 (0)