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.

  • 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 '15 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 '15 at 19:32
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
| improve this answer | |
1

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.