This commit is contained in:
zoicware
2025-01-30 11:37:23 -08:00
committed by GitHub
parent 2ea5819069
commit e66ad96f43

View File

@@ -251,7 +251,15 @@ $installers = Get-ChildItem -Path $inboxapps -Filter '*Copilot*'
foreach ($installer in $installers) {
takeown /f $installer.FullName *>$null
icacls $installer.FullName /grant administrators:F /t *>$null
Remove-Item -Path $installer.FullName -Force
try {
Remove-Item -Path $installer.FullName -Force -ErrorAction Stop
}
catch {
#takeown didnt work remove file with system priv
$command = "Remove-Item -Path $($installer.FullName) -Force"
Run-Trusted -command $command
}
}