You can easily deploy a desktop shortcut using Intune on the desktop of any Windows 10 or Windows 11 device. However, If the deployed shortcut is broken and no longer working. You may want to delete that broken desktop shortcut.
Users may not be able to delete the desktop shortcut from C:\users\Public\desktop due to not having administrator rights. Therefore, IT Admins can use a powershell script to delete the desktop shortcut and push that script using Intune.
Another scenario could be that the existing desktop shortcut is working but you just want to delete it and deploy / create a new desktop shortcut. In this blog post, we will see how you can delete a desktop shortcut from End user devices on Windows 10 or Windows 11 devices.
The shortcut can be deleted from Public desktop or desktop of User’s profile. Public desktop location is C:\users\public\desktop and Desktop path of User’s profile is C:\users<username>\desktop. If your desktop has been redirected to Onedrive then User’s profile desktop location will be C:\Users\<username>\OneDrive – myorg\Desktop.
Please make sure to check the location of the desktop shortcut first and accordingly modify the powershell script to target that location for deleting the desktop shortcut. This step has to be performed manually by logging on to a user’s device or over a remote session to check the location of the desktop shortcut.
Once you know the location of desktop shortcut. We can proceed with creating a powershell script and Intune deployment to push the powershell script on end user devices for deleting the desktop shortcut.
Powershell script to delete desktop shortcut
Let’s take an example of a desktop shortcut of Zoom App deployed using Microsoft Intune. This desktop shortcut is not longer working and we want to delete the shortcut. Manually checking on few of the devices, we found that this broken shortcut exists on Public Desktop location: C:\users\public\desktop.
You can use below script and given steps to delete the desktop shortcut of any application by updating the variable $ShortcutFile. Copy the script code and save it in a .ps1 file. For example: Zoom_delete_shortcut.ps1.
- $ShortcutFile = Provide the location of the shortcut file which needs to be deleted.
$ShortcutFile = "$env:Public\Desktop\Zoom.lnk"
if (Test-Path $ShortcutFile){
Remove-Item $ShortcutFile
} else { Write-Output "Shortcut Not Found" }
If you do not want to delete a desktop shortcut from Public desktop and want to delete it from the desktop of User’s profile. You can use below powershell script code instead and use that to delete it
Desktop path of User’s profile is C:\users<username>\desktop. If your desktop has been redirected to Onedrive then User’s profile desktop location will be C:\Users\<username>\OneDrive – myorg\Desktop. However, in below script code you just need to modify $ShortcutFile variable. Keeping other lines of code as it is.
$DesktopPath = [Environment]::GetFolderPath("Desktop")
$ShortcutFile = "$DesktopPath\Zoom.lnk"
if (Test-Path $ShortcutFile){
Remove-Item $ShortcutFile
} else { Write-Output "Shortcut Not Found" }
Deploy Powershell Script to delete desktop shortcut using Intune
As we now have a Powershell script file created in previous step. We can deploy it on End user devices using Microsoft Intune. Please follow below steps to deploy powershell script on end user devices.
- Login on Microsoft Endpoint Manager Admin Center
- Go to Devices -> Scripts.
- Click on + Add and select Windows 10 and later.

Basics Tab
Provide a Name and Description of the Policy.
- Name: Delete Zoom Desktop shortcut Icon
- Description: This script will delete Zoom Desktop Shortcut Icon from Public Desktop.
Script Settings
On Script settings tab, you can browse to script location to upload into Intune.
- Script Location: Browse to the location where your powershell script is stored. Select powershell script.
- Run this script using the loggedon credentials: Keep it at its default setting No. As we will run this script in System context not user context.
- Enforce script signature check: Keep it at its default setting No.
- Run script in 64 bit Powershell Host: Select Yes. This will run powershell script in 64-bit mode.

Assignments
On the Assignments tab Under Included groups, you can either add an Azure AD security group containing devices or click on + Add all devices to run this script on all end user devices which are managed by Intune.
Review + Add
Review the Summary Information and click on Add to Upload this Powershell script into Intune and Deploy / Execute it on End user devices.
End User Experience
At the target device, when Intune Device check-in process completes. Powershell script will be downloaded on users device and executed from that location. Powershell scripts are downloaded at C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts location.
After Powershell script execution completes on the device, you will see that the targeted desktop shortcut icon will disappear from C:\users\Public\Desktop location.
If your have an added requirement to create another shortcut after the deletion of a broken shortcut. Then you can check the blog post: How to create a desktop shortcut using Intune which provides the steps on how to deploy a desktop shortcut Icon using Microsoft Intune.

We can also check the Intune Management Extension log to check when exactly the script was executed and also in case of any issues we can check this log file to find the problem. Intune Management Extention log file is located at C:\ProgramData\Microsoft\IntuneManagementExtension\Logs location. Log File Name is: IntuneManagementExtension.log.

Conclusion
In this blog post, we have seen how you can delete a desktop shortcut from End user devices. There are two locations from where you can delete a desktop shortcut. First one is from C:\users\public\deskop location and second location is C:\users<username>\desktop or C:\Users\<username>\OneDrive – myorg\Desktop.
The steps given in this blog post is not limited to just the desktop shortcut. You can modify the powershell script to target any location of any file type and deploy the powershell script using Intune to delete targeted file.
For example, If you want to remove a file C:\Temp\testfile.txt or D:\Human Resources\dailylog.xlsx etc. You can modify the powershell script to target these files and deploy the powershell script using Intune on End user devices.
READ NEXT
- How To Create A Desktop Shortcut Using Intune.
- Block USB Drives With Exceptions Using Microsoft Intune.
- Deploy MSI Application On Windows 10 Workstations Using Microsoft Intune.
- 2 Ways To Hide Gaming Under Settings On Windows Using Intune.
- Disable Game Mode On Windows Devices Using Intune.
- How To Import ADMX Templates Into Intune.