Files
management-scripts/Fix-ClearQuickAccess.ps1

21 lines
945 B
PowerShell

# Make sure the computer is running Windows 10
If ( IsWindowsVersion -ge "10.0" ) {
# Path to the Quick Access link list
$FILE = "${Env:AppData}\Microsoft\Windows\Recent\AutomaticDestinations\f01b4d95cf55d32a.automaticDestinations-ms"
$FILEDIR = Split-Path -Path $FILE -Parent
If ( Test-Path $FILE ) {
Write-Output "Clearing Quick Access links"
Try { Remove-Item $FILE -Force }
Catch { Write-Error $_.Exception.Message }
} ElseIf ( Test-Path $FILEDIR ) {
Write-Output "Standard Quick Access link list is not found, clearing out all automatic destinations instead"
Try { Get-ChildItem "${FILEDIR}\*.*" | Where-Object { -not $_.PSIsContainer } | Remove-Item -Force }
Catch { Write-Error $_.Exception.Message }
} Else {
Write-Output "Quick Access lists cannot be found!"
}
} Else {
Write-Output "Quick Access is only available on Windows 10 or greater"
}