# To update a windows system using ansible in a disconnected environment

**URL:** <https://forum.ansible.com/t/to-update-a-windows-system-using-ansible-in-a-disconnected-environment/2351>\
**Category:** Get Help\
**Tags:** windows, collections\
**Created:** [November 14, 2023, 5:36am UTC](https://forum.ansible.com/t/to-update-a-windows-system-using-ansible-in-a-disconnected-environment/2351 "2023-11-14T05:36:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@Jay](https://forum.ansible.com/u/Jay)\
**Post date:** [November 14, 2023, 5:36am UTC](https://forum.ansible.com/t/to-update-a-windows-system-using-ansible-in-a-disconnected-environment/2351/1 "2023-11-14T05:36:50Z")

</div>

I need to update a windows system using ansible in a disconnected environment.  
I’m completely new to this so i need a procedure to do this, can anybody help

#ansible-core #windows #update

---

<div class="post-metadata">

**Author:** ![atul\_mohan](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@atul\_mohan](https://forum.ansible.com/u/atul_mohan)\
**Post date:** [December 29, 2024, 4:56am UTC](https://forum.ansible.com/t/to-update-a-windows-system-using-ansible-in-a-disconnected-environment/2351/2 "2024-12-29T04:56:53Z")

</div>

Transfer the Patch Files to the Windows Host

You can do this with Ansible’s win\_copy (or via a network share).  
Example:

```auto
- name: Copy local patches
  ansible.windows.win_copy:
    src: /path/to/local/KB123456.msu
    dest: C:\temp\KB123456.msu

```

Install the Patch

Use win\_package, win\_command, or win\_shell to install the .msu or .cab file.  
For .msu files, a typical command is:  
powershell  
Copy code  
wusa.exe C:\temp\KB123456.msu /quiet /norestart  
A sample play:

```auto
---
- name: Install MSU updates offline
  hosts: windows
  gather_facts: no
  tasks:

    - name: Copy patch to target
      ansible.windows.win_copy:
        src: /path/to/KB123456.msu
        dest: C:\temp\KB123456.msu

    - name: Install patch with wusa
      ansible.windows.win_command:
        command: wusa.exe C:\temp\KB123456.msu /quiet /norestart

    - name: Reboot if required
      ansible.windows.win_reboot:
        reboot_timeout: 1800
      when: ansible_windows_update_pending is defined

```

If you have multiple updates, repeat for each, or structure them in a loop.  
Check Installation

Optionally verify that the patch is installed using win\_updates (though it may require an actual WSUS or Windows Update source to confirm). Alternatively, check the registry or WMI for presence of the update.
