Forum Discussion

AB21805's avatar
AB21805
Bronze Contributor
Mar 14, 2022

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

     

     

     

Resources