Why want you to create desktop shortcuts with Intune? Business specific apps may require special shortcuts in order to launch the application with the right parameters. Or you need to create a shortcut for an application which is stored on your on premise fileserver. For this purpose I created a little solution which closes the gap between the modern cloud and on premise world. In comparison with other solutions this one works if you have redirected the users desktop with OneDrive Known Folder Move and automatically remediates missing shortcuts if they got deleted.

Direct link to the GitHub repository.

Features

  • This solution works when the desktop is redirected with OneDrive Known Folder Move
  • Everything is user based (local userprofile)
  • If the shortcut is missing or deleted it gets automatically (re)created
  • Possibility to remove shortcut via Intune Win32 app uninstall
  • Shortcut can point to: URL, File (UNC) or Folder (UNC)
  • Ability to pass shortcut arguments
  • Ability to specify shortcut icon (UNC/URL)
  • Ability to deploy shortcut together with an app using Intune Win32 app dependencies

Architecture

A simple PowerShell script which does all the shortcut stuff is wrapped in an executable. The executable is again wrapped with the Intune content prep tool and then distributed as Win32 user-targeted app. This adds the possibility to detect the presence of the shortcut and if required to uninstall it with Intune. In order to work with the redirected desktop to OneDrive with Known Folder Move we can take advantage of the [Environment]::GetFolderPath("Desktop") method to resolve the desktop location.

Configuration

You can find a prepackaged *.intunewin file on my GitHub repository. If you want to wrap your own files you can do this as well, you find all the sources on my GitHub. The "CreateDesktopIcon.ps1" script is wrapped in an executable with with the PS2Exe-GUI available on technet.

Available parameters

The PowerShell script (CreateDesktopIcon.ps1) or executable (CreateDesktopIcon.exe) supports the following command line parameters:

Parameter Explanation
-ShortcutTargetPath Target path for your shortcut. Can be: URL, UNC (file/folder)
-ShortcutDisplayName Display name without file ending
[-PinToStart] Optional: Create start additional start menu shortcut
[-IconFile] Optional: Custom icon file for the shortcut (URL, UNC)
[-ShortcutArguments] Optional: Additional command line arguments for the shortcut

Intune Win32 app configuration

Create a new Win32 app in Intune and upload the "CreateDesktopIcon.intunewin" from my GitHub.

Configure the program settings and specify the parameters for the shortcut creation depending on your needs. Make sure that you change the ShortcutDisplayName in the uninstall command.

Parameter Value
Install command CreateDesktopIcon.exe -ShortcutTargetPath "cmd" -ShortcutDisplayName "cmd"
Uninstall command powershell.exe -command "&{$name='cmd.lnk'; Remove-Item -Path $(Join-Path $([Environment]::GetFolderPath('Desktop')) $name) -EA SilentlyContinue; Remove-Item -Path $(Join-Path $([Environment]::GetFolderPath('StartMenu')) $name) -EA SilentlyContinue}"
Install behavior User

And the detection settings:

Parameter Value
Rules format Use a custom detection script
Script file Use this detection script from my GitHub and change the name to match your ShortcutDisplayName

Last but not least assign the app to your targeted Azure AD group which represents the users who need the shortcut.

Example

Here's a full example which creates a desktop shortcut containing my blogs favicon as icon and points to Microsoft Edge Dev and opens my blog. Basically you can call any web browser and pass your desired website as command line argument.

Additional considerations

  • The solution might be optimized if the PowerShell script gets directly wrapped with the Intune content prep tool but I haven't tested this yet.
  • Additionally the script can be deployed standalone as Intune PowerShell script but then without remediation and detection because it only runs once.
  • At this point I also want to mention that John Seerden has written a great post about shortcuts with Intune using native PowerShell scripts. Mentioning this because I found his post when I was writing this one and the fundamentals are almost the same and i want to be fair.

Happy Desktop-Shortcuting.