【问题标题】:How to Remove\Uninstall all Windows Server feature dependencies for a Windows Feature using ansible\powershell\lifecycle management system如何使用 ansible\\powershell\\lifecycle management system 删除\\卸载 Windows 功能的所有 Windows Server 功能依赖项
【发布时间】:2022-12-09 18:04:19
【问题描述】:

我们已经配置了 GitLab 和 Ansible 来触发 Windows 服务器的创建,我们实现了添加 Windows 功能,添加和删除 Windows 功能是在 yaml 中配置的;

Windows-Feature 
- SMTP-server 

我们已经成功地创建了使用 powershell 安装和卸载功能的逻辑,但是,我们看到每当我们卸载时,仍然安装了很多特定 Windows 功能的依赖项,例如;安装 SMTP 服务器,安装依赖项; RSAT、RSAT-Feature-Tools、RSAT-SMTP、Web-WebServer 等。 删除“SMTP-server”仍然会保留安装的依赖项,这是一个问题。

是否有任何生命周期管理系统或解决方案可以管理管道的 Windows 功能的所有依赖项的卸载?

我们尝试了; (Get-WindowsFeature -Name 'SMTP-Server').DependsOn |使用 while 循环卸载 WindowsFeature,问题是 (Get-WindowsFeature -Name 'SMTP-Server').DependsOn 不会返回所有依赖项,即使我们尝试在嵌套的 DependsOn 上使用 while 循环遍历。

图论,Dependencies Tree Implementation,但Powershell或Ansible中没有明确的技术解决方案。

我们查看了https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_feature_module.html,但 ansible 模块也存在同样的问题。如果我们使用值为 present 的参数 state,然后将参数 state 更改为值不存在,依赖项仍然会安装。

【问题讨论】:

    标签: windows powershell ansible gitlab pipeline


    【解决方案1】:

    弄清楚我们可以使用 Get-WindowsFeature 并使用属性 Parent,DependsOn 创建一个矩阵以删除从一个功能安装的所有功能。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-09
      • 2015-05-02
      • 1970-01-01
      • 1970-01-01
      • 2011-11-11
      • 1970-01-01
      相关资源
      最近更新 更多