Skip to content

Commit 9a81631

Browse files
(GH-147) Fix v3 getting started examples (#149)
Prior to this change, the example code for the v3 getting started article showed passing the parameters for `Invoke-DscResource` as a hash directly to the command. This change fixes the examples by storing the parameter values as a hashtable in a variable and then splatting the hash table with the cmdlet execution. - Fixes AB#82869 - Resolves #147
1 parent 2e5b928 commit 9a81631

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

dsc/docs-conceptual/dsc-3.0/getting-started/getting-started.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Learn how to use the Desired State Configuration feature of PowerShell to manage the state of a machine as code.
3-
ms.date: 01/06/2023
3+
ms.date: 04/04/2023
44
title: Manage configuration using PowerShell DSC
55
---
66

@@ -17,7 +17,7 @@ reference a DSC resource and pass through the properties that define how to mana
1717
Test if the machine is in the correct state, for an example resource.
1818

1919
```powershell
20-
Invoke-DscResource @{
20+
$TestParameters = @{
2121
Name = 'Environment'
2222
ModuleName = 'PSDscResources'
2323
Property = @{
@@ -29,12 +29,13 @@ Invoke-DscResource @{
2929
}
3030
Method = Test
3131
}
32+
Invoke-DscResource @TestParameters
3233
```
3334

3435
Get the current state of a machine, for an example resource.
3536

3637
```powershell
37-
Invoke-DscResource @{
38+
$GetParameters = @{
3839
Name = 'Environment'
3940
ModuleName = 'PSDscResources'
4041
Property = @{
@@ -46,12 +47,13 @@ Invoke-DscResource @{
4647
}
4748
Method = Get
4849
}
50+
Invoke-DscResource @GetParameters
4951
```
5052

5153
Set the state of the machine, for an example resource.
5254

5355
```powershell
54-
Invoke-DscResource @{
56+
$SetParameters = @{
5557
Name = 'Environment'
5658
ModuleName = 'PSDscResources'
5759
Property = @{
@@ -63,10 +65,10 @@ Invoke-DscResource @{
6365
}
6466
Method = Set
6567
}
68+
Invoke-DscResource @SetParameters
6669
```
6770

68-
For additional details, view the
69-
[Invoke-DscResource][01] help.
71+
For more information, view the [Invoke-DscResource][01] help.
7072

7173
## The machine configuration feature of Azure Automanage
7274

0 commit comments

Comments
 (0)