【问题标题】:How to set up client in Powershell 5.0 DSC Pull Mode如何在 Powershell 5.0 DSC 拉模式下设置客户端
【发布时间】:2016-04-26 14:47:40
【问题描述】:

我为 DSC 设置了 2 台服务器,都运行 Powershell 5.0 和 Server 12 R2,DSCPULL 配置为通过 HTTP 的 DSC Pull 服务器,DSCIIS 是客户端。

在 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

我尝试将“Node Localhost”更改为服务器名称,然后使用正确的“ComputerName”运行最后一行,但我得到了同样的错误。

【问题讨论】:

    标签: powershell dsc


    【解决方案1】:

    我应该一直使用 Set-DSCLocalConfigurationManager 而不是 Start-DSCConfiguration

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

    【讨论】:

      猜你喜欢
      • 2017-05-06
      • 2019-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-24
      • 1970-01-01
      • 2015-08-25
      相关资源
      最近更新 更多