# Launching applications remotely with GUI

**URL:** <https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 4, 2016, 3:12pm UTC](https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059 "2016-04-04T15:12:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chethan\_S](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Chethan\_S](https://forum.ansible.com/u/Chethan_S)\
**Post date:** [April 4, 2016, 3:12pm UTC](https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059/1 "2016-04-04T15:12:07Z")

</div>

I was attempting to launch an application through an Ansible Tower job in a remote Windows VM. I’m logged into the remote PC with the same credentials with which my Ansible playbooks are run. For the sake of simplicity, my playbook is like this -

> * * *
> 
> - name: Register and turn on VMs
> 
> hosts: all
> 
> tasks:
> 
> - name: Start VM
> 
> raw: notepad

I expect the above playbook to launch notepad in GUI mode on the remote Windows PC I’m connected to. However, this only adds up a process for notepad.exe but the GUI doesn’t appear. The tower job does not complete either and I end up canceling it. How to ensure that the application launches with a GUI and not as a process?

---

<div class="post-metadata">

**Author:** ![Chethan\_S](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Chethan\_S](https://forum.ansible.com/u/Chethan_S)\
**Post date:** [April 4, 2016, 3:18pm UTC](https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059/2 "2016-04-04T15:18:18Z")

</div>

Ignore those names: I am trying to achieve something else (i.e., turning on VMs but I need them to come up in GUI mode. I guess if notepad can come up, I will figure out the rest.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 5, 2016, 10:46am UTC](https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059/3 "2016-04-05T10:46:00Z")

</div>

I’m fairly certain you won’t have a GUI session, so I think windows has no way of knowing which session to display the notepad user interface in.

You might be able to get a session established by setting auto logon (if you can live with implications of using auto logon) - there’s a powershell script here that can set autologon [http://poshcode.org/2982](http://poshcode.org/2982)

Hope this helps.

Jon

---

<div class="post-metadata">

**Author:** ![Chethan\_S](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Chethan\_S](https://forum.ansible.com/u/Chethan_S)\
**Post date:** [April 5, 2016, 11:20am UTC](https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059/4 "2016-04-05T11:20:42Z")

</div>

In my case, I have an active GUI session. I’m using it to verify if things are working as expected.

Another approach which I have tried in the meantime is using psexec which is known to be helpful in such cases, that is to show the GUI. While I was able to launch notepad.exe by using the psexec executable on the client machine, Ansible used to report the operation as failed. .

Don’t Ansible users use GUI at any point in time to verify if the operations are running as expected? Are end-to-end operations run in an unattended fashion?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 5, 2016, 3:42pm UTC](https://forum.ansible.com/t/launching-applications-remotely-with-gui/21059/5 "2016-04-05T15:42:19Z")

</div>

Generally ansible is intended to fail if the modules can’t achieve their goals. When I’m developing playbooks I do sometime watch the GUI, although much of the checking I do is automated, typically by using register [http://docs.ansible.com/ansible/playbooks\_variables.html#registered-variables](http://docs.ansible.com/ansible/playbooks_variables.html#registered-variables) to record the state returned by modules and then using assert [http://docs.ansible.com/ansible/assert\_module.html](http://docs.ansible.com/ansible/assert_module.html) to ensure the returned state is what I expect.

Its true that some of the checking I do does rely on Powershell, although often this can be accomplished with a single-line Powershell command, for example

`

- name: check if Windows8.1-KB2999226-x64.msu hotfix has been applied  
raw: Get-Hotfix -Id KB2999226  
register: hotfix\_status  
ignore\_errors: true  
`

I’ve used Get-Process in a similar way - something like

`Get-Process -Name notepad`

Hope this helps,

Jon
