Skip to content

Commit 6bd43cf

Browse files
Merge pull request #127096 from gurrajatwal/patch-2
Update 2-create-package.md
2 parents 85c684f + fc7a225 commit 6bd43cf

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

articles/governance/machine-configuration/how-to/develop-custom-package/2-create-package.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ This example configuration is for Windows machines. It configures the machine to
5151
variable sets to `'This was set by machine configuration'`.
5252

5353
```powershell
54+
Install-Module -Name PSDscResources
55+
Import-Module -Name PSDscResources
5456
Configuration MyConfig {
5557
Import-DscResource -Name 'Environment' -ModuleName 'PSDscResources'
5658
Environment MachineConfigurationExample {
@@ -64,11 +66,29 @@ Configuration MyConfig {
6466
MyConfig
6567
```
6668

69+
This example configuration is for Linux machines. It creates a file at the path `/tmp/myfile`, sets its content to `Hello, world!`, and configures the file with mode `0777`.
70+
71+
```powershell
72+
Install-Module -Name nxtools
73+
Import-Module -Name nxtools
74+
Configuration MyConfig {
75+
Import-DscResource -ModuleName 'nxtools'
76+
nxFile MyFile {
77+
Ensure = 'Present'
78+
DestinationPath = '/tmp/myfile'
79+
Contents = 'Hello, world!'
80+
Mode ='0777'
81+
}
82+
}
83+
84+
MyConfig
85+
```
86+
6787
With that definition saved in the `MyConfig.ps1` script file, you can run the script to compile the
6888
configuration.
6989

7090
```powershell
71-
. .\MyConfig.ps1
91+
& .\MyConfig.ps1
7292
```
7393

7494
```output

0 commit comments

Comments
 (0)