2016-04-26 30 views
2

我有2個服務器設置爲DSC,運行Powershell 5.0和服務器12 R2,DSCPULL配置爲通過HTTP的DSC拉服務器,DSCIIS是客戶端。如何設置客戶端在Powershell 5.0 DSC拉模式

在DSCIIS上我試圖設置它,以便它通過配置名稱從Pull服務器下載配置,我從MSDN網站獲取了代碼並略微改變了我的要求,但它仍然無法工作。

[DSCLocalConfigurationManager()] 
configuration PullClientConfigID 
{ 
    Node localhost 
    { 
     Settings 
     { 
      RefreshMode = 'Pull' 
      RefreshFrequencyMins = 30 
      RebootNodeIfNeeded = $true 
     } 

     ConfigurationRepositoryWeb DSCPULL 
     { 
      ServerURL = 'http://DSCPULL:8080/PSDSCPullServer.svc' 
      RegistrationKey = 'test' 
      ConfigurationNames = @('WebServer') 
      AllowUnsecureConnection = $true 
     } 
    } 
} 

PullClientConfigID -OutputPath c:\Configs\TargetNodes 
Start-DscConfiguration C:\Configs\TargetNodes -ComputerName localhost -wait -Verbose 

我收到的錯誤是

Start-DscConfiguration : The computer-specific MOF file for computer localhost does not exist in the current directory. 
At line:1 char:1 
+ Start-DscConfiguration C:\Configs\TargetNodes -ComputerName localhost ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [Start-DscConfiguration], ArgumentException 
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.StartDscConfiguration 
    Command 

我試圖改變「節點本地主機」服務器名稱,然後運行與正確的「計算機名」的最後一行,但我得到了同樣的錯誤。

回答

1

我應該用設置DSCLocalConfigurationManager不是已經啓動DSCConfiguration

Set-DSCLocalConfigurationManager localhost –Path C:\Configs\TargetNodes –Verbose