如何找到 DSC 资源的 parameters/schema?使用我的配置说一个未定义
How do I find the parameters/schema for a DSC Resource? Using my configuration says one is undefined
我正在编写 DSC Pull Server 脚本来生成 MOF 文件。 xDSCWebService 资源需要我定义的值 UseSecurityBestPractices 的布尔值。但是,运行 脚本随后生成错误:"Undefined Property UseSecurityBestPractices".
您可能会说,我对 Powershell 世界相当陌生,尤其是对 DSC。
Link to picture of error message
有什么想法吗?
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
UseSecurityBestPractices
参数在您的资源上不可用。
MSFT_xDSCWebService
在 xPSDesiredStateConfiguration
中可用 https://gallery.technet.microsoft.com/xPSDesiredStateConfiguratio-417dc71d。
下载并打开 zip,您会在 xPSDesiredStateConfiguration_3.0.3.4.zip\xPSDesiredStateConfiguration\DSCResources\MSFT_xDSCWebService 中找到资源的定义,在 MSFT_xDSCWebService.Schema.mof.[= 中找到它的参数架构15=]
可用的参数是:
[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;
};
我正在编写 DSC Pull Server 脚本来生成 MOF 文件。 xDSCWebService 资源需要我定义的值 UseSecurityBestPractices 的布尔值。但是,运行 脚本随后生成错误:"Undefined Property UseSecurityBestPractices".
您可能会说,我对 Powershell 世界相当陌生,尤其是对 DSC。
Link to picture of error message
有什么想法吗?
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
UseSecurityBestPractices
参数在您的资源上不可用。
MSFT_xDSCWebService
在 xPSDesiredStateConfiguration
中可用 https://gallery.technet.microsoft.com/xPSDesiredStateConfiguratio-417dc71d。
下载并打开 zip,您会在 xPSDesiredStateConfiguration_3.0.3.4.zip\xPSDesiredStateConfiguration\DSCResources\MSFT_xDSCWebService 中找到资源的定义,在 MSFT_xDSCWebService.Schema.mof.[= 中找到它的参数架构15=]
可用的参数是:
[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;
};