DSC状态不变 [英] DSC States Not Changing

查看:95
本文介绍了DSC状态不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有通过DSC连接到Azure自动化的Windows机器。 

I have on premise Windows machines hooked up to Azure Automation via DSC. 

有时,当应用新状态时,仪表板将停留在不符合标准的情况下,等待或失败。 (我已经看到它发生在每个州)。

Sometimes when a new state is applied, the dashboard will stay stuck on non compliant, pending, or failed. (I've seen it happen with each state).

在这个特定的实例中,失败的脚本资源检查每个网络以确保它是私有的,然后将它们设置为私有的不是。 
$


日志表明它第一次失败,因为网络处于"识别"状态。有道理它会失败。但是,我希望它的下一次运行转向兼容,因为防火墙肯定设置为私有(在有问题的
机器上验证)。以下是防火墙私有脚本资源:



In this specific instance, the script resource that failed checks each network to make sure it is private, and then sets them private if they are not. 

The logs indicate it failed the first time because the network was in an 'identifying' state. It makes sense it would fail. However, I would expect the next run for it to turn to compliant, because the firewall is definitely set to private (verified on the machine in question). Here is the firewall private script resource:

 Script FirewallPrivate {
            GetScript = {
               Write-Verbose "No get script needed"
            }
            TestScript = {
                foreach($profile in Get-NetConnectionProfile)
                {
                    if($profile.NetworkCategory -ne 'Private' ) {
                        Return $False
                    }                  
                }
                Return $True
            }
            SetScript = {
                foreach($profile in Get-NetConnectionProfile)
                {
                    $profile.NetworkCategory = 'Private'
                    Set-NetConnectionProfile -InputObject $profile -Verbose
                }
            }
        }

此外,相关问题是,单个节点仪表板与所有节点仪表板不同。单个节点处于不合规状态,但在所有节点屏幕中,其设置为失败。

Also, a related issue, the individual node dashboard differs from the all nodes dashboard. The individual node is in a non compliant state, however in the all nodes screen, its set to failed.




推荐答案

要让节点自行进行更正,您可以验证
ConfigurationMode
属性是
设置为
ApplyandAutoCorrect?
For the node to make a correction itself, can you verify the ConfigurationMode property is set to ApplyandAutoCorrect?


这篇关于DSC状态不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆