We had to do a rest on some computers and the reset created Windows.old folders that I need to get removed. The worklet says it removes the folders but they are not removed. Any help would be greatly appreciated.
$folders = @("C:\Windows.old", "C:\Windows.old(1)", "C:\Windows.old(2)")
foreach ($folder in $folders) {
if (Test-Path $folder) {
Remove-Item -Path $folder -Recurse -Force
Write-Output "Deleted: $folder"
} else {
Write-Output "Not found: $folder"
}
}
