Take Ownership and Change Admins to Full Rights

$folderMask = "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*"
$folders = Get-ChildItem -Path $folderMask -Directory | Where-Object { $_.Name -like "*_x64_*" }
foreach ($folder in $folders) {
    $folderPath = $folder.FullName
    TAKEOWN /F $folderPath /R /A /D Y
    ICACLS $folderPath /grant Administrators:F /T
}

 


Revision #1
Created 2023-11-10 04:18:45 UTC by Ryan
Updated 2025-03-12 17:09:15 UTC by Ryan