From 9c5a1ebba5c610c5ee89fa025b73b8c568a46b88 Mon Sep 17 00:00:00 2001
From: Cory Silva <2672972+coryasilva@users.noreply.github.com>
Date: Mon, 11 Nov 2019 20:33:56 -0800
Subject: [PATCH] Add Local Security Policy update example (#60897)

* Add Local Security Policy update example

##### SUMMARY
This real world example will be useful, but perhaps there is a better section?


##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr

* Move new example and add not to username
---
 lib/ansible/modules/windows/win_scheduled_task.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/ansible/modules/windows/win_scheduled_task.py b/lib/ansible/modules/windows/win_scheduled_task.py
index afee0c6bbbb..b30dc638ce1 100644
--- a/lib/ansible/modules/windows/win_scheduled_task.py
+++ b/lib/ansible/modules/windows/win_scheduled_task.py
@@ -260,6 +260,8 @@ options:
     - The user to run the scheduled task as.
     - Will default to the current user under an interactive token if not
       specified during creation.
+    - The user account specified must have the C(SeBatchLogonRight) logon right
+      which can be added with M(win_user_right).
     type: str
     aliases: [ user ]
   password:
@@ -435,6 +437,7 @@ notes:
   see U(https://techcommunity.microsoft.com/t5/Core-Infrastructure-and-Security/Windows-Server-2012-Group-Managed-Service-Accounts/ba-p/255910)
 seealso:
 - module: win_scheduled_task_stat
+- module: win_user_right
 author:
 - Peter Mounce (@petemounce)
 - Jordan Borean (@jborean93)
@@ -470,6 +473,14 @@ EXAMPLES = r'''
     run_level: highest
     state: present
 
+- name: Update Local Security Policy to allow users to run scheduled tasks
+  win_user_right:
+    name: SeBatchLogonRight
+    users:
+    - LocalUser
+    - DOMAIN\NetworkUser
+    action: add
+
 - name: Change above task to run under a domain user account, storing the passwords
   win_scheduled_task:
     name: TaskName2