首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DSC不拉配置

DSC不拉配置
EN

Server Fault用户
提问于 2019-06-06 08:22:10
回答 1查看 101关注 0票数 1

我的DSC节点没有从我的SMB DSC服务器中提取DSC配置。说拉是成功的,但是DSCConfigurationStatus保持不变(旧配置)。

我在C驱动器上创建一个文件的HelloWorld配置来测试它。我没有任何错误或其他任何事。为什么它拉得不对。

我的DSC LCM配置:

代码语言:javascript
复制
$secpasswd = ConvertTo-SecureString “PASSWORD” -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (“SERVUSER”, $secpasswd)

[DSCLocalConfigurationManager()]
configuration PullClientConfig
{
    param(
    [PSCredential]$DomainCredential
)

    Node 'localhost'
    {
        Settings
        {
            RefreshMode = 'Pull'
            RefreshFrequencyMins = 30
            RebootNodeIfNeeded = $false
            ConfigurationID = '2fda9b6d-e1be-46a9-8b92-e25cb17026cd'

        }

         ConfigurationRepositoryShare SmbConfigShare
        {
            SourcePath = '\\SERVER\SHARE'
            Credential = $mycreds
        }

        ResourceRepositoryShare SmbResourceShare
        {
            SourcePath = '\\SERVER\SHARE'
            Credential = $mycreds

        }
    }
}
$cd = @{
    AllNodes = @(
        @{
            NodeName = 'localhost'
            PSDscAllowPlainTextPassword = $true
        }
    )
}

我的HelloWord配置:

代码语言:javascript
复制
Configuration HelloWorld {

    param (
        [string[]]$ComputerName = "localhost" # i have changed this parameter to the servername
    )

    # Import the module that contains the File resource.
    Import-DscResource -ModuleName PsDesiredStateConfiguration

    # The Node statement specifies which targets to compile MOF files for, when this configuration is executed.
    Node $ComputerName {

        # The File resource can ensure the state of files, or copy them from a source to a destination with persistent updates.
        File HelloWorld {
            DestinationPath = "C:\HelloWorld.txt"
            Ensure = "Present"
            Contents   = "Hello World from DSC!"
        }
    }
}

更新-DScConfiguration说,没有新的配置,所以它不会拉。我是否理解DSC正确的,它有一个配置和节点尝试适合这个配置。因此,它必须再次拉一个配置,并应用它,相反,它保留旧的配置,拒绝拉。但是旧的配置是错误的..。我不明白..。

EN

回答 1

Server Fault用户

回答已采纳

发布于 2019-07-16 13:13:56

这是ConfigurationMode,它必须在DSCLocalConfigurationManager中的设置下设置为ApplyAndAutocorrect!

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/970337

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档