3

I am trying to launch an application that needs ui on a windows box as part of "vagrant provision". I can see that the app is launched as the vagrant user in task manager but I see no ui on the screen.

For example if I use something as simple as:

config.vm.provision "shell", inline: <<-SHELL
  notepad
SHELL

I need the ui - why does it not show ? Now there might be a better way to launch the app, still I am curious whats going on ?

Running the same directly on the machine in powershell works fine.

2
  • Look at how the user is running, for example it can be SYSTEM user. Then, to access it graphical tool should also start from under the same user.
    – STTR
    Jun 17, 2015 at 8:21
  • 1
    Vagrant runs any provisioning under the vagrant user by default and because of double hop and UAC issues it already runs all provisioners through a scheduled task. The reason this isn't working is because the provisioner runs under a different login session - even if it's the same user.
    – Sneal
    Jul 1, 2015 at 19:32

2 Answers 2

2

A workaround is to use schtasks to trigger the command, something like this:

config.vm.provision "shell", inline: <<-SHELL
  # Create a task that will never run automatically
  schtasks /create /tn "notepad" /tr "notepad.exe" /sc monthly /st 07:00 /sd 01/01/1980 /f
  # Run it now
  schtasks /run /tn notepad
SHELL
1

This can be achieved with the powershell_elevated_interactive option (which apparently creates and runs a scheduled task under the covers).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .