Tutorial by Examples

[DscResource()] class File { } This example demonstrates how to build the outer section of a PowerShell class, that declares a DSC Resource. You still need to fill in the contents of the class definition.
[DscResource()] class Ticket { [DscProperty(Key)] [string] $TicketId } A DSC Resource must declare at least one key property. The key property is what uniquely identifies the resource from other resources. For example, let's say that you're building a DSC Resource that represents a ticket...
[DscResource()] class Ticket { [DscProperty(Key)] [string] $TicketId [DscProperty(Mandatory)] [string] $Subject } When building a DSC Resource, you'll often find that not every single property should be mandatory. However, there are some core properties that you'll want to ensure ...
[DscResource()] class Ticket { [DscProperty(Key)] [string] $TicketId # The subject line of the ticket [DscProperty(Mandatory)] [string] $Subject # Get / Set if ticket should be open or closed [DscProperty(Mandatory)] [string] $TicketState [void] Set() { # Creat...

Page 1 of 1