How do you use the win_security_policy module for something in the local policies section using Ansible?

  ansible, hardening, windows

I want to be able to modify certain local policies on my WS 2019. I’ve tried to use the win_security_policy module from ansible but it doesn’t recognize the section "local policies". According to the ansible documentation, local policies is a section, I might be having trouble with my key and value but the error I get is the following:

The section 'Local Policies' does not exist in SecEdit.exe output ini

This is the policy I want to enabled: Devices:
Prevent users from installing printer drives located under Computer ConfigurationPoliciesWindows SettingsSecurity SettingsLocal
PoliciesSecurity Options

- name: test for local group policy editor
    win_security_policy:
    section: Local Policies
    key: Prevent users from installing printer drivers
    value: 1

I’m really not sure about the way I go about this, I didn’t find any examples with this section in particular. Any help is appreciated!

Source: Windows Questions

LEAVE A COMMENT