From 1dfc646fb3dd0f7b22a45d6c17ae0669933d7011 Mon Sep 17 00:00:00 2001 From: John Rizzo Date: Fri, 21 Apr 2017 17:18:21 -0400 Subject: [PATCH] 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. --- lib/vagrant/util/platform.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 5ad926395..09dcbbc16 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -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