Forum Discussion
AB21805
Mar 14, 2022Bronze Contributor
deleting a shortcut on desktop via intune
Hi all,
How do I delete a shortcut via intune?
I have created a shortcut using powershell but I had to update the URL which seems to have broke the shortcut so need to delete it and redeploy a new shortcut.
Please help!
AB21805 Changed it to handle both situations:
Detection:
$desktop = [Environment]::GetFolderPath("Desktop") if (Test-Path -Path "$($desktop)\Wifi Connect.lnk") { write-Host Found shortcut exit 1 } Else { Write-Host Shortcut not found exit 0 }
Remediation:
$desktop = [Environment]::GetFolderPath("Desktop") Remove-Item -Path "$($desktop)\Wifi Connect.lnk" -Force:$true
- You can run a Remediation script on your devices with a detection and remove script (If you have Windows Enterprise) or run a script (https://endpoint.microsoft.com/#blade/Microsoft_Intune_DeviceSettings/DevicesMenu/powershell) which is just a "remove-item c:\users\public\desktop\shortcut.url" The last will run only once if succesful and is perhaps the fasted method now I guess?
- AB21805Bronze ContributorJust trying this now! thank you. I will let you know how I get on
- AB21805Bronze Contributor
I have had it running for a while now. I have passed the Detection with no issues but the remediation hasnt run yet and its been like 4 hours:
I used https://www.imab.dk/remove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations/ for help
Any ideas?
Could you share the detection and remediation script? Anything showing in the logs of a client? (And it is a Windows 10/11 Enterprise machine?)