Author Posts

November 4, 2015 at 3:06 pm

Hi, I'm trying to understand how to explore what is available for DSC resources. What I mean by that is if I'm in the PowerShell console and I want to do something with a service and I don't know what is available I just type "Get-Help *service* and I get a nice list of all the CmdLets with service in the name. Oh, I want to call "Get-Service", what does that take? Let me type "Get-Help Get-Service -Full". Boom, everything I could possibly want to know about every parameter, types, and examples. There's even a nice link to the online version.

Enter DSC. I want to create a configuration script that makes sure service XYZ is there. I happen to know there is a MS provided Service resource but other than that, no ideas on what parameters it takes. How/Where do I figure that out? What I love about PS is how easy the help system is. I have no clue how to do this for the DSC resources. I've just started looking into DSC so I've probably just missed it, but I sure hope there is a way to figure this out.

November 7, 2015 at 8:29 pm

Hi Bart,

Closest thing to help is the syntax/and or some explanations on Github.

PS C:\WINDOWS\system32> Get-DscResource -Syntax file
File [String] #ResourceName
{
DestinationPath = [string]
[Attributes = [string[]]{ Archive | Hidden | ReadOnly | System }]
[Checksum = [string]{ CreatedDate | ModifiedDate | SHA-1 | SHA-256 | SHA-512 }]
[Contents = [string]]
[Credential = [PSCredential]]
[DependsOn = [string[]]]
[Ensure = [string]{ Absent | Present }]
[Force = [bool]]
[MatchSource = [bool]]
[PsDscRunAsCredential = [PSCredential]]
[Recurse = [bool]]
[SourcePath = [string]]
[Type = [string]{ Directory | File }]
}

November 7, 2015 at 10:55 pm

Also check out
https://mva.microsoft.com/en-us/training-courses/getting-started-with-powershell-desired-state-configuration-dsc–8672
By Snover and Helmick. It then leads onto the advanced stuff. Then check out Jones' dsc recource vids on the mva site.