From 8ac49b9d8291433b4d66fc9471d595fc2cb43a62 Mon Sep 17 00:00:00 2001 From: Microsoft Corporation Date: Tue, 2 Sep 2025 16:04:05 -0700 Subject: [PATCH] Revert "query group name from SID (#377)" This reverts commit 03d4cc8e4e2700ecbaa6a98cffabe15e05dcc1cc. --- pkg/fs/fs_windows.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) 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