Merge pull request #10000 from chrisroberts/f-hyperv-access-localized

Fix Hyper-V access check
This commit is contained in:
Chris Roberts 2018-07-18 16:39:54 -07:00 committed by GitHub
commit 110600970a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@ param(
$check = Check-VagrantHyperVAccess -Path $Path
$result = @{
root_dir = ($Path -split '\\')[0,2] -join '\';
root_dir = ($Path -split '\\')[0,1] -join '\';
result = $check
}

View File

@ -709,7 +709,11 @@ function Check-VagrantHyperVAccess {
[string] $Path
)
$acl = Get-ACL -Path $Path
$systemACL = $acl.Access | where {$_.IdentityReference -eq "NT AUTHORITY\System" -and $_.FileSystemRights -eq "FullControl" -and $_.AccessControlType -eq "Allow" -and $_.IsInherited -eq $true}
$systemACL = $acl.Access | where {
$_.IdentityReference.Translate([System.Security.Principal.SecurityIdentifier]).Value -eq "S-1-5-18" -and
$_.FileSystemRights -eq "FullControl" -and
$_.AccessControlType -eq "Allow" -and
$_.IsInherited -eq $true}
if($systemACL) {
return $true
}