$foldersToDelete = @(
"C:\Users\BRXXXX\AppData\Local\Microsoft\Windows\winx\GROUP2",
"C:\Users\BRXXXX\AppData\Local\Microsoft\Windows\winx\GROUP3"
)
foreach ($folderPath in $foldersToDelete) {
if (Test-Path $folderPath -PathType Container) {
Write-Host "Deleting folder: $folderPath"
Remove-Item -Path $folderPath -Force -Recurse
} else {
Write-Host "Folder not found: $folderPath"
}
}
Powershell script to delete folders under Winx
Santhosh B S
106
Reputation points
Team,
I am looking for a script which should delete folders under C:\Users\BRXXXX\Appdata\Local\Micorsoft\Windows\winx\GROUP2 and GROUP3
and i need to retain the folders under winx for Administrator, defaultuser ,Default ,Public
Please help
Windows for business Windows Server User experience PowerShell
8,330 questions
1 answer
Sort by: Most helpful
-
Tushar Kumar 3,371 Reputation points MVP
2023-05-18T14:09:31.7166667+00:00