Powershell 如何找到DSC资源的参数/架构?使用我的配置表示一个未定义
我正在编写一个DSC Pull服务器脚本来生成MOF文件。xDSCWebService资源需要一个布尔值作为我定义的UseSecurityBestPractices值。但是,运行脚本会生成一个错误:“Undefined Property UseSecurityBestPractices” 正如您可能知道的,我对Powershell世界,尤其是DSC是相当陌生的。Powershell 如何找到DSC资源的参数/架构?使用我的配置表示一个未定义,powershell,dsc,Powershell,Dsc,我正在编写一个DSC Pull服务器脚本来生成MOF文件。xDSCWebService资源需要一个布尔值作为我定义的UseSecurityBestPractices值。但是,运行脚本会生成一个错误:“Undefined Property UseSecurityBestPractices” 正如您可能知道的,我对Powershell世界,尤其是DSC是相当陌生的。 有什么想法吗 Configuration NewPullServer { $ComputerName = 'localhost' I
有什么想法吗
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\uxdscwebservice
可从中的xPSDesiredStateConfiguration
获得
下载并打开zip,您将在xPSDesiredStateConfiguration_3.0.3.4.zip\xPSDesiredStateConfiguration\DSCResources\MSFT_xDSCWebService中找到资源的定义,并在MSFT_xDSCWebService.schema.mof中找到其参数schema
可用参数包括:
[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;
};
如果您使用的是来自的MSFTxdscWebService,则它不支持该属性。如果是的话,请告诉我,我会发帖回答。是的,就是这样。干杯