设置UP DSC Pull Server时出错

时间:2015-05-04 14:32:52

标签: powershell dsc

我正在尝试设置Powershell DSC Pull Server。我将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

如果我犯了任何错误,请告诉我。

1 个答案:

答案 0 :(得分:0)

很好地开始你拼写第一行错误的配置名称

配置CreatePullServe1r

最后你运行CreatePullServer(最后没有1)

但不,这个DSC配置在我的计算机上工作正常,您必须遇到服务器本地的问题,并且最有可能通过清除缓存或重新启动WMI服务来修复。

相关问题