PowerShell DSC一起推拉模式(PowerShell DSC Pull and Push Mode Together)

系统教程 行业动态 更新时间:2024-06-14 16:58:30
PowerShell DSC一起推拉模式(PowerShell DSC Pull and Push Mode Together)

我正在使用PowerShell 4.0并配置了DSC Pull Server。 很少有客户端连接到Pull Server,这些客户端正在正确配置。 以下是客户端计算机中的LCM详细信息:

但是,有时我们希望将配置推送到这些客户端。 当我尝试推送时,它成功并且RefershMode变为PUSH,所有其他设置都像以前一样。 从现在开始,我不再从Pull服务器获得任何配置。 我再次需要将模式更改为PUSH并且工作正常。

是否可以在同一客户端计算机中配置Pull和Push模式? 那些会一起工作吗?

谢谢你的帮助!

I am using PowerShell 4.0 and configured a DSC Pull Server. Few clients are connected to the Pull Server and those are getting configurations properly. Below is the LCM details in a client machine:

However, there are some times we would like to push a configuration to these clients. When I try to push, it is successful and the RefershMode gets changed to PUSH and all other settings are as it was before. Now from now onwards I don’t get any configuration from the Pull server anymore. Again I needed to change the mode to PUSH and it works fine.

Can both Pull and Push modes can be configured in the same client machine ? Will those work together ?

Thanks for your help!

最满意答案

不,这些模式不能存在于同一台机器上; 它是一个或另一个。

我不得不质疑你为什么要这样做。 据推测,如果机器已经处于Pull配置中,那么您要推送到其上的配置必须与Pull服务器上的配置不同。 如果是这种情况,为什么你想恢复到完全覆盖Push配置的Pull呢?

根据您的评论,我建议您在要进行更改时更改节点的Pull服务器上的配置。 生成MOF文件和校验和文件然后将它们复制到Pull服务器的过程可以自动完成。 然后你可以使用:

Invoke-CimMethod -Namespace root/Microsoft/Windows/DesiredStateConfiguration –ClassName MSFT_DSCLocalConfigurationManager -MethodName PerformRequiredConfigurationChecks -Arg @{Flags = [System.UInt32]1 } -ComputerName $targetNode 
 

强制节点拉取并重新应用配置。

No, these modes cannot exist on the same machine; it's one or the other.

I have to question why you would want to do this. Presumably, if a machine is already in a Pull configuration, then the configuration you want to Push onto it must be different from what's on the Pull server. If that's the case, why would you want to then revert to Pull which would completely override the Push configuration?

Based on your comment, I would recommend that you change the configuration on the Pull server for the node(s) when you want to make changes. The process of generating the MOF files and the checksum files and then copying them to the Pull server can be automated. You can then use:

Invoke-CimMethod -Namespace root/Microsoft/Windows/DesiredStateConfiguration –ClassName MSFT_DSCLocalConfigurationManager -MethodName PerformRequiredConfigurationChecks -Arg @{Flags = [System.UInt32]1 } -ComputerName $targetNode 
 

to force the Node to pull and re-apply configuration.

更多推荐

本文发布于:2023-04-15 03:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/913809e60925a4c9ec00544464dce84a.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:推拉   模式   DSC   PowerShell   Push

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!