如何在 Powershell 5.0 DSC Pull 模式下设置客户端

How to set up client in Powershell 5.0 DSC Pull Mode

我为 DSC 设置了 2 个服务器,运行ning Powershell 5.0 和 Server 12 R2,DSCPULL 配置为通过 HTTP 的 DSC 拉取服务器,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",但我得到了同样的错误。

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

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