Shiffle McDoobles
Shiffle McDoobles

Reputation: 3

How do I find the parameters/schema for a DSC Resource? Using my configuration says one is undefined

I'm writing a DSC Pull Server script to generate a MOF file. The xDSCWebService resource requires a boolean for the value UseSecurityBestPractices which I have defined. However, running the script then generates an error: "Undefined Property UseSecurityBestPractices".

As you can probably tell, I'm fairly new to the Powershell world and especially to DSC.
Link to picture of error message
Any ideas?

Configuration NewPullServer
{
$ComputerName = 'localhost'
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -Name xDSCWebService

Node $ComputerName 
{
    WindowsFeature DSCServiceFeature
    {
        Ensure = "Present"
        Name = "DSC-Service"
    }

    xDscWebService PSDSCPullServer
    {
        Ensure = "Present"
        UseSecurityBestPractices = $True
        EndpointName = "PSDSCPullServer"
        Port = 8080
        PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer"
        CertificateThumbprint = "AllowUnencryptedTraffic"
        ModulePath = "$env:PROGRAMFILES\WindowsPowershell\DscService\Modules"
        ConfigurationPath = "$env:PROGRAMFILES\WindowsPowershell\DscService\Configuration"
        State = "Started"
        DependsOn = "[WindowsFeature]DSCServiceFeature"
    }

    xDscWebService PSDSCComplianceServer
    {
        Ensure = "Present"
        EndpointName = "PSDSCComplianceServer"
        Port = 9080
        PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer"
        CertificateThumbprint = "AllowUnencryptedTraffic"
        State = "Started"
        UseSecurityBestPractices = $True
        DependsOn = ("[WindowsFeature]DSCServiceFeature","[xDSCWebService]PSDSCPullServer")
    }
}
}


NewPullServer
Start-DscConfiguration ./NewPullServer -Wait -verbose

Upvotes: 0

Views: 607

Answers (1)

Matthew Wetmore
Matthew Wetmore

Reputation: 988

The UseSecurityBestPractices parameter is not available on your resource.

The MSFT_xDSCWebService is available in xPSDesiredStateConfiguration from https://gallery.technet.microsoft.com/xPSDesiredStateConfiguratio-417dc71d.

Downloading and opening the zip, you'll find the definition of the resource in xPSDesiredStateConfiguration_3.0.3.4.zip\xPSDesiredStateConfiguration\DSCResources\MSFT_xDSCWebService, and its parameter schema in MSFT_xDSCWebService.Schema.mof.

The available parameters are:

[ClassVersion("1.0.0"), FriendlyName("xDSCWebService")] 
class MSFT_xDSCWebService : OMI_BaseResource
{
  [Key] string EndpointName;
  [required] string CertificateThumbPrint;
  [write] uint32 Port;
  [write] string PhysicalPath;
  [write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure;
  [write,ValueMap{"Started","Stopped"},Values{"Started", "Stopped"}] string State;
  [write] string ModulePath;
  [write] string ConfigurationPath;
  [write] boolean IsComplianceServer;
  [read] string DSCServerUrl;  
};

Upvotes: 1

Related Questions