StartProcess doesn't work with raw

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?

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?

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