Fix #5
This commit is contained in:
10
RemoveAi.ps1
10
RemoveAi.ps1
@@ -251,7 +251,15 @@ $installers = Get-ChildItem -Path $inboxapps -Filter '*Copilot*'
|
|||||||
foreach ($installer in $installers) {
|
foreach ($installer in $installers) {
|
||||||
takeown /f $installer.FullName *>$null
|
takeown /f $installer.FullName *>$null
|
||||||
icacls $installer.FullName /grant administrators:F /t *>$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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user