Reputation: 2926
I'm trying to figure out what syntactical element is in use for a Powershell DSC resource declaration. For example:
SqlServerNetwork "RDBMS"
{
DependsOn = @("[SqlSetup]RDBMS")
InstanceName = "MSSQLSERVER"
ProtocolName = "tcp"
IsEnabled = $true
TCPPort = 1433
RestartService = $true
}
What exactly is the syntactical block between (and including) the two braces? It's not a hashtable (no @
) nor is it a scriptblock (cos that would make the properties be Powershell statements). It feels like a parameter to the resource, so I'd like to understand the syntax.
Upvotes: 3
Views: 98
Reputation: 9975
I can't find any definitive reference, but I think the entire SqlServerNetwork "RDBMS" { … }
is a Dynamic Keyword Statement, and the { … }
are "properties".
If you look at the source code for the PowerShell parser here:
there's this comment:
/// keyword [parameters] [name] { a=1; b=2; } # constructor with properties
in the xml comments for the DynamicKeywordStatementRule
function, which matches the syntax of the DSC block.
If that's the case, the reference for DynamicKeywordStatementAst
is here:
That's as far as I can get though. Hopefully someone else can give some more details.
Upvotes: 3