StartProcess doesn't work with raw

66 views
Skip to first unread message

ja...@3scan.com

unread,
May 3, 2016, 12:17:20 PM5/3/16
to Ansible Project
I recently started using Ansible to control Windows and I'm have some trouble with the StartProcess command.

On a regular Powershell terminal I can open a new shell with this command:
StartProcess powershell

However this task in Ansible does not have that result:
- name: Start powershell
  raw: 'StartProcess powershell'

Is Ansible incapable of spawning new windows in this way?

Matt Davis

unread,
May 3, 2016, 1:57:04 PM5/3/16
to Ansible Project
hmm: ansible win -i hosts -m raw -a "start-process powershell"  seems to work fine for me (though not sure what purpose that would serve, since the process will get nuked when the winrm connection closes). 

What is it you're trying to accomplish?

J Hawkesworth

unread,
May 4, 2016, 6:30:40 AM5/4/16
to Ansible Project
When you say 'spawning new Windows' it makes me think maybe you are expecting applications to start up and display a graphical user interface?  

You are unlikely to be able to do this as you won't have an interactive user session (just winrm remoting session).  

Starting services and command line applications is likely to be fine though as typically services don't start new windows and command line (STDOUT, STDERR) output can be captured and returned from the winrm remote session.

If you happen to have interactive services (ones that do start a user interface panel) there are a few options - have a look at my talk slides from ansiblefest london here: http://www.slideshare.net/jhawkesworth/ansible-20-windows-and-no-powershell-this-year-i-promise-ansiblefest-london-2016

Hope this helps,

Jon
Reply all
Reply to author
Forward
0 new messages