# Ansible run cmd\\powershell as admin doesnt change anything

**URL:** <https://forum.ansible.com/t/ansible-run-cmd-powershell-as-admin-doesnt-change-anything/36571>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 27, 2022, 2:23pm UTC](https://forum.ansible.com/t/ansible-run-cmd-powershell-as-admin-doesnt-change-anything/36571 "2022-04-27T14:23:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![batchenr](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/batchenr/32/7123_2.png) [@batchenr](https://forum.ansible.com/u/batchenr)\
**Post date:** [April 27, 2022, 2:23pm UTC](https://forum.ansible.com/t/ansible-run-cmd-powershell-as-admin-doesnt-change-anything/36571/1 "2022-04-27T14:23:45Z")

</div>

Win 10 enterprise ansible 2.9

Using this playbook on a vm in order to change something in windows GPO :

— - hosts: localhost  
connection: local  
vars: vars\_files: - vars.yml  
become\_method: runas  
tasks:

- name: “GPO change”  
vmware\_vm\_shell:  
cluster: “{{ cluster }}”  
datacenter: “{{ datacenter }}”  
hostname: “{{ vcenter\_server }}”  
username: “{{ vcenter\_user }}”  
password: “{{ vcenter\_pass }}”  
folder: “{{ folder }}”  
vm\_id: “{{ name }}”  
vm\_username: “{{ vm\_username }}”  
vm\_password: “{{ vm\_password }}”  
vm\_shell: ‘C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe’ vm\_shell\_args: reg add HKEY\_LOCAL\_MACHINE\SOFTWARE\Policies\Microsoft\SystemCertificates\AuthRoot /v DisableRootAutoUpdate /t REG\_DWORD /d 1 /f;gpupdate /force  
wait\_for\_process: yes  
validate\_certs: no  
delegate\_to: localhost  
register: shell\_command\_output
- debug: msg: “{{ shell\_command\_output }}”

This have to run as admin but apparently it doesn’t and GPO doesn’t change. what am i doing wrong?

log:

ok: [localhost] =\> { “msg”:  
{ “changed”: true, “cmd\_line”: “"C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe"  
reg add HKEY\_LOCAL\_MACHINE\SOFTWARE\Policies\Microsoft\SystemCertificates\AuthRoot /v DisableRootAutoUpdate /t REG\_DWORD /d 1 /f;gpupdate /force”, “end\_time”: “2022-04-27T13:24:14+00:00”,  
“exit\_code”: 0, “failed”: false, “name”: “powershell.exe”, “owner”: “XXX”, “start\_time”: “2022-04-27T13:24:03+00:00”, “uuid”: “420b5786-5d90-785f-5b2e-98ba3a400e73” } } PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
