Fixed admin test to verify that you are running in an elevated shell, not that you are in the administrators group since that is not required.

This commit is contained in:
John Rizzo 2017-04-21 17:18:21 -04:00 committed by Chris Roberts
parent 9018ba7fd6
commit 1dfc646fb3
1 changed files with 2 additions and 2 deletions

View File

@ -51,9 +51,9 @@ module Vagrant
return @_windows_admin if defined?(@_windows_admin)
@_windows_admin = -> {
ps_cmd = "[System.Security.Principal.WindowsIdentity]::GetCurrent().Groups | ForEach-Object { if ($_.Value -eq 'S-1-5-19'){ Write-Host 'true'; break }}"
ps_cmd = '(new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)'
output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
return output == 'true'
return output == 'True'
}.call
return @_windows_admin