Parts of the .psd1 that you do not need to parse into the .ps1 configuration

This topic contains 1 reply, has 2 voices, and was last updated by  Don Jones 3 weeks, 5 days ago.

  • Author
    Posts
  • #82397

    Cody Konior
    Participant

    I'm only just learning DSC so I have a pretty basic question.

    I understand so far that there's two ways to generate MOFs; one is through a .ps1 which has a basic Configuration { node { } } syntax, and the other through a .psd1 with a @{ AllNodes = @{ }; @{ Node = ""; }; } hashtable format and a .ps1 which parses it like Configuration { node $AllNodes.NodeName { }; }.

    One thing that is confusing me though is, if you use the second format, there seems to be some parts which you are NOT meant to parse and which instead are *somehow* picked up by DSC separately. Examples:
    * CertificateFile
    * Thumbprint (but not LocalConfigurationManager.CertificateID; that you have to parse out)
    * PSDscAllowDomainUser
    * PSDscAllowPlainTextPassword

    Right? Because when I look at other people's files they have those tags in their .psd1 but aren't parsing/outputting it in their .ps1 Configuration block. Which is a little confusing.

    How does DSC pick those up, or, more accurately, is there a way to know which tags I shouldn't be parsing and those that I should? Maybe there's more that I should be aware of?

    Thanks

  • #82865

    Don Jones
    Keymaster

    I understand so far that there's two ways to generate MOFs; one is through a .ps1 which has a basic Configuration { node { } } syntax, and the other through a .psd1 with a @{ AllNodes = @{ }; @{ Node = ""; }; } hashtable format and a .ps1 which parses it like Configuration { node $AllNodes.NodeName { }; }.

    Well, no, not exactly. A .psd1 doesn't "generate" a MOF. A .psd1 is meant to feed configuration data into a .ps1, so that a single .ps1 can output multiple customized MOFs. And as you note, the .psd1 is just a convenient way of separating the configuration data; it can also be supplied in other ways.

    Right? Because when I look at other people's files they have those tags in their .psd1 but aren't parsing/outputting it in their .ps1 Configuration block. Which is a little confusing.

    There are some configuration data items which are "well known" to PowerShell, and which it "knows" to look for and output into the resulting MOFs. You don't have to explicitly deal with these yourself.

    How does DSC pick those up, or, more accurately, is there a way to know which tags I shouldn't be parsing and those that I should? Maybe there's more that I should be aware of?

    "How" is "it's programmed that way at the factory." And no, there really aren't a bunch. Nobody's keeping extra secrets from you :).

You must be logged in to reply to this topic.