diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index 3a20dbd..097d098 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -1529,7 +1529,13 @@ function Remove-AI-Files { foreach ($keyword in $aiKeyWords) { foreach ($location in $regLocations) { Get-ChildItem $location -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -like "*$keyword*" } | ForEach-Object { - Remove-Item $_.PSPath -Recurse -Force -ErrorAction SilentlyContinue + try { + Remove-Item $_.PSPath -Recurse -Force -ErrorAction Stop + } + catch { + #ignore when path is null + } + } }