Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyper-V provider requires user be an admin instead of requiring user has Hyper-V permissions #4503

Closed
pvandervelde opened this issue Sep 14, 2014 · 6 comments

Comments

Projects
None yet
5 participants
@pvandervelde
Copy link

commented Sep 14, 2014

In order to interact with Hyper-V the user needs specific permissions (normally only provided to administrators) however these permissions can be granted to other users. I have done so with my account and can access hyper-v both from the Hyper-V manager as well as through powershell without elevating to admin. Unfortunately Vagrant requires me to be an admin. It would be much better if Vagrant would verify that the user has access to Hyper-V before requiring elevation.

@am11

This comment has been minimized.

Copy link

commented Oct 11, 2014

This is a very good suggestion and a painful experience TBVH. Thanks for pointing it out. 👍

Going by their code, it was assumed this quick and dirty approach: http://stackoverflow.com/a/21586953/863980, was the best course of action.

Just posted my answer here: http://stackoverflow.com/a/26318600/863980. I believe there exists even better (WMI) way of figuring it out. Now going by this suggestion, perhaps @factormystic can enlighten us again. 💡

@lukebakken

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2015

As a note, Windows 8.1 has a "Hyper-V Administrators" group that makes it very easy to give a regular user the correct permissions.

The hyper-v provider should attempt an operation and, if it fails, examine the returned error. If it is "access denied" then vagrant should alert the user that an elevated shell is necessary.

I commented out the following lines as a workaround:

https://github.com/mitchellh/vagrant/blob/master/plugins/providers/hyperv/provider.rb#L19-L21

@am11

This comment has been minimized.

Copy link

commented Jan 23, 2015

@lukebakken, would be nice if you can send a PR for this. :)

@mitchellh

This comment has been minimized.

Copy link
Member

commented Nov 23, 2015

I'd love to add this but I'm not familiar enough with PowerShell to figure out the right approach to this. If someone can open a PR I'd gladly merge. Until then, we'll keep requiring admin privs, sorry!

@mitchellh mitchellh closed this Nov 23, 2015

mitchellh added a commit that referenced this issue Dec 14, 2015

@shamakhov

This comment has been minimized.

Copy link

commented Mar 30, 2016

The issue is not fixed in localized Windows versions because of translated group names. This group has name 'Администраторы Hyper-V' in Russian Windows version.

@lukebakken

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2016

@shamakhov - you would have to determine if the current user is a member of the group with SID S-1-5-32-578. Using net localgroup was a "good enough" fix. I'll see about doing it the right way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.