diff --git a/pkg/fs/fs_windows.go b/pkg/fs/fs_windows.go index 9a1eaf50..87d1a854 100644 --- a/pkg/fs/fs_windows.go +++ b/pkg/fs/fs_windows.go @@ -8,7 +8,6 @@ import ( "strings" "github.com/hectane/go-acl" - "github.com/microsoft/moc-pkg/pkg/powershell" "github.com/microsoft/moc/pkg/errors" ) @@ -32,17 +31,7 @@ func ChmodRecursiveAdmin(path string) error { } // Step 2: Grant admin permission to the directory - getBuiltInAdminGroupName := `function Get-BuiltInAdminName { - param() - $obj = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544") - $name = ($obj.Translate([System.Security.Principal.NTAccount])).Value - "$name" - } -` - builtInAdminGroupName, err := powershell.ExecutePowershell(getBuiltInAdminGroupName, `Get-BuiltInAdminName`) - builtInAdminGroupNamePermissions := strings.TrimSpace(builtInAdminGroupName) + ":(OI)(CI)(F)" - - cmd = exec.Command("icacls", path, "/grant", builtInAdminGroupNamePermissions) + cmd = exec.Command("icacls", path, "/grant", "BUILTIN\\Administrators:(OI)(CI)(F)") _, err = cmd.CombinedOutput() if err != nil { return err