Have a worklet that find and removes appdata for a legacy application from all user profiles on a system. Unfortunately it doesn’t appear to be working when I run it for all endpoints ( worked fine for a single endpoint test ).
$NameShort = "Q-Pulse"
if ($NameShort.Length -gt 7) {
$NameShort = $NameShort.Substring(0, 4) + "\."
}
$rex = $NameShort + "\..+"
$Paths = @(
"$env:Localappdata\Apps\2.0"
"$env:Localappdata\Deployment"
"$env:Localappdata\Microsoft\Windows\INetCache\IE"
"$env:Temp\Deployment"
)
foreach ($Path in $Paths) {
Get-ChildItem -Recurse $Path | ForEach-Object {
If ($_ -match $rex) {
Remove-Item -Force -Recurse $_.FullName
}
}
}
$startMenuPath = [Environment]::GetFolderPath("StartMenu")
$appShortcut = Get-ChildItem -Path $startMenuPath -Recurse -Filter "*$($NameShort)*.appref-ms"
if ($appShortcut) {
Remove-Item -Path $appShortcut.FullName -Force
}
Remove-Item -Path "$env:USERPROFILE\Desktop\$($NameShort).appref-ms" -Force
Any help is greatly appreciated.