--- - name: Change the power plan to high performance community.windows.win_power_plan: name: "{{ win_obs_init_powerplan_mode }}" - name: "Apply custom powerplan poweshell script as {{ win_obs_init__user }}" ansible.windows.win_powershell: script: | Write-Host "Disabling Screensaver" Set-ItemProperty "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -Type DWord & powercfg -x -monitor-timeout-ac 0 & powercfg -x -monitor-timeout-dc 0 & powercfg -x standby-timeout-ac 0 & powercfg -x standby-timeout-dc 0 & powercfg -x hibernate-timeout-ac 0 & powercfg -x hibernate-timeout-dc 0 & powercfg -x disk-timeout-ac 0 & powercfg -x disk-timeout-dc 0 become: true become_method: ansible.builtin.runas become_user: "{{ win_obs_init__user }}" vars: ansible_become_pass: '{{ win_obs_init__password }}' changed_when: _user.changed