@@ -8,12 +8,12 @@ title: about Classes and DSC
8
8
---
9
9
# about_Classes_and_DSC
10
10
11
- ## SHORT DESCRIPTION
11
+ ## Short description
12
12
13
13
Describes how you can use classes to develop in PowerShell with Desired State
14
14
Configuration (DSC).
15
15
16
- ## LONG DESCRIPTION
16
+ ## Long description
17
17
18
18
Starting in Windows PowerShell 5.0, language was added to define classes and
19
19
other user-defined types, by using formal syntax and semantics that are
@@ -22,7 +22,7 @@ developers and IT professionals to embrace Windows PowerShell for a wider
22
22
range of use cases, simplify development of PowerShell artifacts such as DSC
23
23
resources, and accelerate coverage of management surfaces.
24
24
25
- ## SUPPORTED SCENARIOS
25
+ ## Supported scenarios
26
26
27
27
The following scenarios are supported:
28
28
@@ -34,7 +34,7 @@ The following scenarios are supported:
34
34
- Generate and handle exceptions by using formal mechanisms, and at the right
35
35
level.
36
36
37
- ## DEFINE DSC RESOURCES WITH CLASSES
37
+ ## Define DSC resources with classes
38
38
39
39
Apart from syntax changes, the major differences between a class-defined DSC
40
40
resource and a cmdlet DSC resource provider are the following items:
@@ -43,7 +43,7 @@ resource and a cmdlet DSC resource provider are the following items:
43
43
- A DSCResource subfolder in the module folder is not required.
44
44
- A PowerShell module file can contain multiple DSC resource classes.
45
45
46
- ## CREATE A CLASS-DEFINED DSC RESOURCE PROVIDER
46
+ ## Create a class-defined DSC resource provider
47
47
48
48
The following example is a class-defined DSC resource provider that is saved
49
49
as a module, MyDSCResource.psm1. You must always include a key property in a
@@ -246,7 +246,7 @@ class FileResource
246
246
}
247
247
```
248
248
249
- ## CREATE A MODULE MANIFEST
249
+ ## Create a module manifest
250
250
251
251
After creating the class-defined DSC resource provider, and saving it as a
252
252
module, create a module manifest for the module. To make a class-based
@@ -290,7 +290,7 @@ PowerShellVersion = '5.0'
290
290
}
291
291
```
292
292
293
- ## DEPLOY A DSC RESOURCE PROVIDER
293
+ ## Deploy a DSC resource provider
294
294
295
295
Deploy the new DSC resource provider by creating a MyDscResource folder in
296
296
` $pshome\Modules ` or ` $env:SystemDrive\ProgramFiles\WindowsPowerShell\Modules ` .
@@ -302,7 +302,7 @@ MyDscResource folder.
302
302
From this point, you create and run a configuration script as you would with
303
303
any DSC resource.
304
304
305
- ## CREATE A DSC CONFIGURATION SCRIPT
305
+ ## Create a DSC configuration script
306
306
307
307
After saving the class and manifest files in the folder structure as described
308
308
earlier, you can create a configuration that uses the new resource. The
@@ -336,7 +336,7 @@ configuration, in an elevated PowerShell console, run the following:
336
336
337
337
` PS C:\test> .\MyResource.ps1 `
338
338
339
- ## INHERITANCE IN POWERSHELL CLASSES
339
+ ## Inheritance in PowerShell classes
340
340
341
341
### Declare base classes for PowerShell classes
342
342
@@ -467,7 +467,7 @@ $list[0] # return 200
467
467
A limitation with class inheritance is that there is no syntax to declare
468
468
interfaces in PowerShell.
469
469
470
- ## DEFINING CUSTOM TYPES IN POWERSHELL
470
+ ## Defining custom types in PowerShell
471
471
472
472
Windows PowerShell 5.0 introduced several language elements.
473
473
@@ -694,7 +694,7 @@ $v = bar
694
694
$v -eq $d # true
695
695
```
696
696
697
- ## EXAMPLE: CREATE CUSTOM CLASSES
697
+ ## Example: Create custom classes
698
698
699
699
The following example creates several new, custom classes to implement an HTML
700
700
Dynamic Stylesheet Language (DSL). The example adds helper functions to create
@@ -825,7 +825,7 @@ function Style
825
825
function Html ([HTML] $doc) { return $doc }
826
826
```
827
827
828
- ## SEE ALSO
828
+ ## See also
829
829
830
830
[ about_DesiredStateConfiguration] ( /powershell/module/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration )
831
831
0 commit comments