2015-05-04 124 views
-1

我想安裝Powershell DSC拉服務器。我複製xPSDesiredStateConfiguration DSC模塊,C:\ WINDOWS \ SYSTEM32 \ WindowsPowerShell \ V1.0 \模塊錯誤設置DSC拉服務器

當我試圖運行下面的腳本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 

請讓我知道如果我犯了什麼錯誤。

回答

0

很好地啓動你拼配置名稱錯誤在第一線

配置CreatePullServe1r

在最後你(末尾由於沒有1)運行CreatePullServer

但不,這個DSC配置在我的電腦上工作正常,你必須有一個本地服務器的問題,並且可以通過清除緩存或重新啓動WMI服務來解決問題。