packer icon indicating copy to clipboard operation
packer copied to clipboard

Windows - allow sshd service to interact with desktop

Open mahmoud-ashi opened this issue 4 years ago • 7 comments

When creating a service on windows, you can choose to allow the service to interact with the desktop. This way, user can launch GUI apps.

mahmoud-ashi avatar Mar 15 '20 00:03 mahmoud-ashi

@mahmoud-ashi thanks for raising this, I will try to include this in the upcoming release.

gusztavvargadr avatar Mar 15 '20 09:03 gusztavvargadr

As a workaround, i used: # Enable auto login for powershell_elevated_interactive to work! # https://gist.github.com/StefanScherer/adbb421dc0adca75b49e0031a99595a5

Bnaya avatar Jun 08 '20 09:06 Bnaya

@Bnaya thanks for sharing this.

@mahmoud-ashi can you describe please your scenario a bit more detail? Do you lack permissions or the consol session (e.g. for GUI apps)?

gusztavvargadr avatar Jun 08 '20 13:06 gusztavvargadr

I would like to share my code, and my use case: https://github.com/Bnaya/vagrant-webdriver-collection/blob/master/Vagrantfile#L31-L42

My use case is, that i want to start webdriver-manager, and if it's not running with: powershell_elevated_interactive: true, it doesn't work + after user login it doesn't work

Bnaya avatar Jun 10 '20 20:06 Bnaya

@Bnaya did you also try with setting the privileged flag? https://github.com/Bnaya/vagrant-webdriver-collection/blob/bbb398fe81cd3a61ea9a0b79a9a023f676ccdd5f/Vagrantfile#L46

According to the docs both are required to make the interactive script work: https://www.vagrantup.com/docs/provisioning/shell.html#powershell_elevated_interactive

gusztavvargadr avatar Jun 10 '20 22:06 gusztavvargadr

@Bnaya any luck with this?

gusztavvargadr avatar Jun 20 '20 20:06 gusztavvargadr

@mahmoud-ashi any luck with this so far? I will add the necessary settings in the upcoming release, but you can try the settings here as well in the meantime: https://docs.microsoft.com/en-us/windows/win32/services/interactive-services. Besides the flag for the service, a global registry key needs to be changed as well.

However, it seems from the article as well that this is a not recommended approach. Could you try something like scheduled tasks for the same scenario?

gusztavvargadr avatar Jun 20 '20 20:06 gusztavvargadr