title: Ansible playbook, what is the proper syntax to run a powershell script with a specific (domain) user, in an elevated mode?
body: <p>running Ansible 2.4.2 in an offline environment, using kerberos to authenticate, </p>
  
  <p>Via an ansible playbook, what is the proper syntax to run a powershell script with a specific (domain) user: DOMAIN\someuser, in an elevated mode?</p>
  
  <p>By elevated mode I mean that in the Windows interface, I'd run the script by login in as DOMAIN\someuser , then by right clicking a cmd or powershell prompt shortcut, choosing "run as administrator". 
  This of course does not mean I can run the script with the local user: "administrator".</p>
  
  <p>What I want to run is:</p>
  
  <pre><code>powershell.exe -executionpolicy bypass -noninteractive -nologo -file "myscript.ps1" 
  </code></pre>
  
  <p>What I tried in a become.yml:</p>
  
  <pre><code>- name: sigh
    win_command: powershell.exe -executionpolicy bypass -noninteractive -nologo -file "myscript.ps1" 
    become: yes
    become_user: DOMAIN\someuser
    become_password: someuserpassword
    become_method: runas
  </code></pre>
  
  <p>The script runs, with errors that relate to it not running in elevation.
  Tried the same with win_shell and raw. Tried without the become_user and become_password (the yml runs with the someuser@DOMAIN.local user and password so I don't really know if it's required for become).</p>
  
  <p>I'm dragging through this and finding no reference to a solution via become:
  <a href="http://docs.ansible.com/ansible/latest/become.html" rel="noreferrer">http://docs.ansible.com/ansible/latest/become.html</a></p>
  
  <p>Any ideas?</p>