Run powershell script on Windows servers which require Powershell to be run with admin privilages
73 views
Skip to first unread message
Ashish Vijay
unread,
May 22, 2017, 10:19:12 AM5/22/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hello All,
I want to execute one powershell script on few target servers which require powershell to be run as administrator. I am getting access denied error when i try with normal playbook.
- name: Install software on Wndows Remote server. hosts: all tasks:
- name: run a powershell script script: install.ps1 -Install -arg '{{ ARGLIST }}' register: out1 - debug: var=out1
I am getting access denied error when i try to execute this playbook.
Trond Hindenes
unread,
May 22, 2017, 1:40:27 PM5/22/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
There's no such thing as UAT/"run as admin" when using WinRM (which Ansible does). What does your script do, exactly?
Jordan Borean
unread,
May 22, 2017, 4:07:45 PM5/22/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
I could be wrong but when calling script it looks locally on the Ansible box and not the windows one. Can you specify your script without using win_copy and see what happens?
J Hawkesworth
unread,
May 23, 2017, 12:41:18 PM5/23/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
hosts: all
will try and run on all hosts in your inventory. These are unlikely to be all windows hosts.
I suggest limiting just to windows host to start with. -l option.
Also how are you running the playbook? what command line is used? where is 'ARGLIST' defined?