-1

Powershell DSC プル サーバーをセットアップしようとしています。xPSDesiredStateConfiguration DSC モジュールを C:\Windows\System32\WindowsPowerShell\v1.0\Modules にコピーしました

以下の dsc スクリプトを実行しようとすると:

configuration CreatePullServe1r
{
  param
  (
    [string[]]$ComputerName = 'localhost'
  )

  Import-DSCResource -ModuleName xPSDesiredStateConfiguration

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

    xDscWebService PSDSCPullServer
    {
      Ensure         = "Present"
      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"
      IsComplianceServer   = $true
      DependsOn        = ("[WindowsFeature]DSCServiceFeature","[xDSCWebService]PSDSCPullServer")
    }

  }

}

CreatePullServer -ComputerName pull1.lab.pri

次のエラー メッセージが表示されます。

At line:1 char:15
+ configuration CreatePullServe1r
+               ~~~~~~~~~~~~~~~~~
System.IO.DirectoryNotFoundException: Could not find a part of the path 
'C:\Windows\system32\WindowsPowershell\v1.0\Modules\PSDesiredStateConfiguration\PSProviders'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption 
searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.EnumerateDirectories(String path)
   at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.Initialize(Collection`1 errors)
   at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.LoadDefaultCimKeywords(Dictionary`2 functionsToDefine, 
Collection`1 errors)
   at System.Management.Automation.Language.Parser.ConfigurationStatementRule(Token configurationToken)
At line:2 char:1
+ {
+ ~
Unexpected token '{' in expression or statement.
At line:45 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ParserError

私が間違いを犯している場合はお知らせください。

4

1 に答える 1

0

まず、最初の行で構成名のスペルが間違っています

"構成 CreatePullServe1r "

最後に君が走るCreatePullServer(最後に1がない)

しかし、いいえ、この DSC 構成は私のコンピューターで正常に動作します。サーバーにローカルな問題が発生している必要があり、キャッシュをクリアするか、WMI サービスを再起動することで解決できる可能性が高くなります。

于 2015-06-01T08:29:57.933 に答える