windows – 如何在推送设置中进行正确的错误处理?
发布时间:2020-12-13 23:18:52 所属栏目:Windows 来源:网络整理
导读:我目前正在建立一个实验室环境,以了解DSC可以实现什么以及限制在哪里. 我们需要根据操作系统,AD组成员资格和包含目标的OU等标准将一次性配置推送到节点组. 所以我开发了以下示例脚本: # Pulls computer objects from Active DirectoryFunction Get-Nodes{ P
我目前正在建立一个实验室环境,以了解DSC可以实现什么以及限制在哪里.
我们需要根据操作系统,AD组成员资格和包含目标的OU等标准将一次性配置推送到节点组. 所以我开发了以下示例脚本: # Pulls computer objects from Active Directory Function Get-Nodes { Param($OperatingSystem) Get-AdComputer -Filter 'OperatingSystem -eq ${OperatingSystem}' -SearchBase "OU=SomeThing,DC=contoso,DC=com" } # Defines the configuration to apply Configuration ConfigureHostsPush { Node $Allnodes.NodeName { # This resource is not able to delete a key,only values Registry ConfigureRegistry { Ensure = "Present" Key = "HKEY_LOCAL_MACHINESOFTWARE" ValueName = "MachineType" ValueData = "Hyper-V" } # This logs the defined message at the _destination_ host # within Microsoft->Windows->DesiredStateConfiguration->Analytic # requires showing and enabling the log first! Log LogSuccessfulRegistry { Message = "Successfully configued the defined registry value" DependsOn = "[Registry]ConfigureRegistry" } } } $nodes = Get-Nodes -OperatingSystem "Windows Server 2012 R2 Standard" # $nodes = Get-Nodes -OperatingSystem "Windows Server 2008 R2 Standard" # $nodes = Get-Nodes -OperatingSystem "Windows 7 Professional" # Pulls a list of nodes into a hash table $ConfigData = @{ AllNodes = @( foreach ($node in $nodes) { @{NodeName = $node.Name} } ) } # Generate the MOFs based on the configuration and hosts pulled from AD ConfigureHostsPush -ConfigurationData $ConfigData # Actually push out the configuration to the nodes Start-DscConfiguration -wait -Path D:DATADSCConfigureHostsPush 但是,在我的情况下,某些节点并不总是可以访问并且处于脱机状态.我该如何进行错误处理和记录?所以我以后可以控制哪些节点成功配置或需要重新配置. 我知道我可以使用DSC日志资源,但这似乎非常有限,只能在LCM /目标节点端生成日志.
一种方法是不跟踪.只需将所有mof文件放在一个文件夹中,并让计划任务每??天运行两次,将它们推送到您的节点.这很容易设置和管理.设置它并忘记它.
预期的用例是设置拉服务器.您仍然必须配置每个节点与拉取服务器通信.由于节点必须使用拉取服务器签入,因此您确实有一个中心位置,可以告诉您节点是否已签入并且配置正确.您还可以更改拉取服务器上的配置,节点将在下次签入时获取该配置.您不必照看推送过程. 在开始尝试配置所有现有服务器时,您将面临最大的问题.但是,在未来,部署新服务器将处于您可以在配置过程中密切管理的状态. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 使用WPF DataGridHyperLinkColumn项打开Windows资源管理器并
- windows – 如何从文件内容设置环境变量?
- windows-server-2012-r2 – Windows 2012 DNS服务器淘汰
- 带有API的Windows Server 2008防病毒软件
- Windows Azure角色可以检测角色所在的数据中心吗?
- windows-7 – Android Studio无法启动
- windows-server-2008-r2 – 重新启动后,Windows 2008 R2会忘
- windows – 使用Cygwin进行FFMPEG构建错误cmp:command not
- 应用内购买 – 购买Windows Phone应用内商品的截止日期?
- 如何以编程方式刷新Windows资源管理器?