# uninstall windows packages via ansible

**URL:** <https://forum.ansible.com/t/uninstall-windows-packages-via-ansible/38624>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [December 12, 2023, 2:57pm UTC](https://forum.ansible.com/t/uninstall-windows-packages-via-ansible/38624 "2023-12-12T14:57:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrakid](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/astrakid/32/1789_2.png) [@astrakid](https://forum.ansible.com/u/astrakid)\
**Post date:** [December 12, 2023, 2:57pm UTC](https://forum.ansible.com/t/uninstall-windows-packages-via-ansible/38624/1 "2023-12-12T14:57:03Z")

</div>

hi,  
i am trying to update some windows software packages, e.g. notepad++ and firefox. it doesn’t work, because the installed software can’t be removed or updated.

having a look onto notepad++ version 8.1.x is installed, 8.6 should get installed. i am using an executable:

- name: install NotepadPlusPlus {{ nppversion }}  
win\_package:  
path: “C:\temp\npp.{{ nppversion }}.Installer.x64.exe”  
product\_id: Notepad++  
arguments: /S  
state: present  
when: inventory\_hostname in groups[“notepadplusplus”]

ansible quits with “ok”, but the version is still 8.1.x

trying to remove the package with powershell fails:  
uninstall via win\_shell with ‘get-package -name “notepad\*” -maxversion 8.5 | uninstall-package -Force’ tells “changed”, but software is still existing on the server.

any idea how to solve this?

TASK [remove notepad++ win\_shell] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [myserver]

TASK [debug packagestatus] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [myserver] =\> {  
“packagestatus”: {  
“changed”: true,  
“cmd”: “get-package "Notepad\*" -maximumversion 8.5 | uninstall-package -Force -scope allusers”,  
“delta”: “0:01:08.874457”,  
“end”: “2023-12-12 02:55:48.249888”,  
“failed”: false,  
“rc”: 0,  
“start”: “2023-12-12 02:54:39.375431”,  
“stderr”: “”,  
“stderr\_lines”: ,  
“stdout”: “”,  
“stdout\_lines”:   
}  
}

regards,  
andre
