win_regedit software restriction HKCU

17 views
Skip to first unread message

Kumaresh kulal

unread,
Apr 20, 2020, 7:34:54 AM4/20/20
to Ansible Project
I am working on win_regedit playbook to restrict software.

So far the win_regedit playbook gets created for HKEY_LOCAL_MACHINE below is the playbook:

---


- hosts: windows


  tasks:


   - name: Creating a registry


     win_regedit:


      path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


   - name: Modifying a registry, adding name and data


     win_regedit:


      path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


      value: 1


      datatype: string


      data: 'cmd.exe'



But Registry is not getting created for HKEY_CURRENT_USER


---


- hosts: windows


  tasks:


   - name: Creating a registry


     win_regedit:


      path: HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


   - name: Modifying a registry, adding name and data


     win_regedit:


      path: HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


      value: 1


      datatype: string


      data: 'cmd.exe'



Even tried writing simple registry 


---


- hosts: windows


  tasks:


   - name: Creating a registry


     win_regedit:

      path: HKCU:\Software\MyCompany



Thanks in Advance!!


--

Kumaresh



Reply all
Reply to author
Forward
0 new messages