Install and uninstalls Windows hotfixes
- Install, uninstall a Windows hotfix.
Note
- This must be run on a host that has the DISM powershell module installed and a Powershell version >= 4.
- This module is installed by default on Windows 8 and Server 2012 and newer.
- You can manually install this module on Windows 7 and Server 2008 R2 by installing the Windows ADK https://developer.microsoft.com/en-us/windows/hardware/windows-assessment-deployment-kit, see examples to see how to do it with chocolatey.
- You can download hotfixes from https://www.catalog.update.microsoft.com/Home.aspx.
.. seealso:: :ref:`ansible.windows.win_package_module` The official documentation on the **ansible.windows.win_package** module. :ref:`ansible.windows.win_updates_module` The official documentation on the **ansible.windows.win_updates** module.
- name: Install Windows ADK with DISM for Server 2008 R2
chocolatey.chocolatey.win_chocolatey:
name: windows-adk
version: 8.100.26866.0
state: present
install_args: /features OptionId.DeploymentTools
- name: Install hotfix without validating the KB and Identifier
community.windows.win_hotfix:
source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
state: present
register: hotfix_install
- ansible.windows.win_reboot:
when: hotfix_install.reboot_required
- name: Install hotfix validating KB
community.windows.win_hotfix:
hotfix_kb: KB3172729
source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
state: present
register: hotfix_install
- ansible.windows.win_reboot:
when: hotfix_install.reboot_required
- name: Install hotfix validating Identifier
community.windows.win_hotfix:
hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
state: present
register: hotfix_install
- ansible.windows.win_reboot:
when: hotfix_install.reboot_required
- name: Uninstall hotfix with Identifier
community.windows.win_hotfix:
hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
state: absent
register: hotfix_uninstall
- ansible.windows.win_reboot:
when: hotfix_uninstall.reboot_required
- name: Uninstall hotfix with KB (not recommended)
community.windows.win_hotfix:
hotfix_kb: KB3172729
state: absent
register: hotfix_uninstall
- ansible.windows.win_reboot:
when: hotfix_uninstall.reboot_required
Common return values are documented here, the following are the fields unique to this module:
- Jordan Borean (@jborean93)