Skip to content
Desktop shortcut intune
Home » Manage desktop shortcut(s) / icon with Intune

Manage desktop shortcut(s) / icon with Intune

Again and again I encounter the situation that customers want to have predefined desktop shortcuts for programs, websites or web applications distributed. In order to be able to distribute and update these efficiently, I created a PowerShell script that distributes the desktop shortcut(s) with Intune, if desired with a specific icon. I then pack the whole thing into a win32 application in order to work with versions as well.

Table of Contents


Here you can find my template including two example links: GitHub - scloud/DesktopShortcut

My solution offers the possibility of either using predefined links or maintaining them in a CSV.
You can simply store the predefined shortcuts under ".\Desktop". Make sure that if icons are stored, they only work as long as they are also available on the target system at the appropriate location.
In the CSV (link-list.csv) you only have to enter the shortcut name, the link and the icon. Place the icon in the "icon" folder.

Distribution - PowerShell Script

The entire distribution is handled by the "install.ps1" file.

In a first step I define the package name and the version. I also start a transcript of the process to have a log locally on the device.

$PackageName = "DesktopIcon_SLZ" $Version = "1" $Path_4netIntune = "$Env:Programfiles\4net\EndpointManager" Start-Transcript -Path "$Path_4netIntune\Log\$PackageName-install.log" -Force
Code language: PowerShell (powershell)

In the second step, I define and create the paths or folders that I need for the links and icons.

# Paths $DesktopTMP = "$Path_4netIntune\Data\Desktop\$PackageName" $DesktopIcons = "$Path_4netIntune\Data\icons\$PackageName" # Create Folders New-Item -Path $DesktopTMP -ItemType directory -force New-Item -Path $DesktopIcons -ItemType directory -force New-Item -Path "C:\Users\Public\Desktop" -ItemType directory -force
Code language: PowerShell (powershell)

Third, I remove possible previous versions of the package, its shortcuts on the desktop, and icons in the local folder.

# Remove old shortcuts and icons $OLD_Items = Get-ChildItem -Path $DesktopTMP foreach($OLD_Item in $OLD_Items){ Remove-Item "C:\Users\Public\Desktop\$($OLD_Item.Name)" -Force } Remove-Item "$DesktopTMP\*" -Force Remove-Item "$DesktopIcons\*" -Force
Code language: PowerShell (powershell)

In the fourth step I copy all predefined icons from the "Desktop" folder to the temporary local folder on the PC.

# Copy New shortcuts Copy-Item -Path ".\Desktop\*" -Destination $DesktopTMP -Recurse Copy-Item -Path ".\icons\*" -Destination $DesktopIcons -Recurse
Code language: PowerShell (powershell)

Then I read in the CSV and also create the defined shortcuts in the temporary desktop folder.

# shortcuts from list $shortcuts = Import-CSV "link-list.csv" foreach($shortcut in $shortcuts){ $WshShell = New-Object -comObject WScript.Shell $Shortcut_file = $WshShell.CreateShortcut("$DesktopTMP\$($") $Shortcut_file.TargetPath = $ $Shortcut_file.IconLocation = "$DesktopIcons\$($shortcut.icon)" $Shortcut_file.Save() }
Code language: PowerShell (powershell)

After the copying process and the creation of all shortcuts, I copy them to the public desktop of the device.

# Copy icons to public Desktop Copy-Item -Path "$DesktopTMP\*" -Destination "C:\Users\Public\Desktop" -Recurse
Code language: PowerShell (powershell)

Finally, I create a file that acts as a detection rule and contains the version of my package. I also stop the transcript.

# Validation New-Item -Path "$Path_4netIntune\Validation\$PackageName" -ItemType "file" -Force -Value $Version Stop-Transcript
Code language: PowerShell (powershell)

The detection rule

The detection rule reads the validation file and its content and compares it with the version number. If everything is correct, this is reported to Intune. If you adjust the package name or the version in "install.ps1", you must also do this in "check.ps1".

$PackageName = "DesktopIcon_SLZ" $Version = "1" $ProgramVersion_current = Get-Content -Path "$Env:Programfiles\4net\EndpointManager\Validation\$PackageName" if($ProgramVersion_current -eq $Version){ Write-Host "Found it!" }
Code language: PowerShell (powershell)

Intune win32 package

With the Intune Win32 Prep Tool the package is created after the CSV and/or the desktop folder is filled:

intunewin desktop shortcut win32

We then upload the created "install.intunewin" file to MEM/Intune and set the appropriate parameters. (red mandatory, orange optional, but helpful if the company portal is used.)

SurnameDesktop shortcuts or individually
descriptionNote on the links
iconfreely selectable
installation command%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\install.ps1
uninstall command%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\uninstall.ps1
conditionsx64 and 2004 (Windows version not relevant)
Detection rulecustom script, check.ps1
allocationdepending on requirements
win32 upload desktop shortcut
win32 install command desktop shortcut
win32 requirements desktop shortcut
win32 detection rule desktop shortcut

Would you like to automatically upload the link(s) right away?
Then I have an article for you here: wi
n32 app deployment automated

Installation Demo (Company Portal)

This is the installation process via the company portal, with the user initiating the installation. Distribution via targeting also works. The process of using Intune to distribute a desktop shortcut with an icon is so very simple and practical. Updates are also implemented quickly.

demo win32 intune desktop shortcut

10 thoughts on “Desktop Verknüpfung(en) / Icon mit Intune verwalten”

    1. Based on the last package configuration old icons will be removed and new added.
      For this purpose, I save a copy of the package's shortcuts unter "C:\Program Files\4net\EndpointManager\Data\Desktop"
      It is important to raise the version number for this scenario.

  1. Pingback: Proactively remove unwanted desktop shortcuts | scloud

  2. Can I use this to deploy multiple icons at once? For example, I'm looking to deploy, Outlook, Word, Excel and Powerpoint icons within one go so I can add this to the company portal. How would I do that?

  3. Great script. But how do I include a shortcut to open in Inprivate window?

    I tried to add another csv (link-list1.csv) with the following PS, but didn't worked.

    $shortcuts1 = Import-CSV "link-list1.csv"
    foreach($shortcut1 in $shortcuts1){
    $WshShell = New-Object -comObject WScript.Shell
    $Shortcut_file1 = $WshShell.CreateShortcut("$DesktopTMP\$($")
    $Shortcut_file1.WorkingDirectory = $shortcut1.path
    $Shortcut_file1.TargetPath = $
    $Shortcut_file1.IconLocation = "$DesktopIcons\$($shortcut1.icon)"

    1. Hi Sahil, you could create a custom shortcut and place it in the "Desktop" folder. Within the CSV only direct url/links are possible.
      The custom URL would look like:
      "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -inprivate ""

      1. Hi Florian,

        Yes, I tried that. But the link is not opening in inprivate window.

        I also tried adding the custom URL in CSV, but still won't work

      2. Hey Florian: I figured out. You have to place the incognito shortcut in the Desktop folder with the icon in icons folder and then in the CSV add the shortcut name and icon entries keeping the link field empty.

        It was also creating duplicate shortcuts - .url copied from the $DesktopTMP folder and .lnk created from the link-list.csv. So I just added incognito shortcuts in the Desktop folder and other shortcuts added in the csv file.

        Thank you again for this great script.

Leave a Reply

Your email address will not be published.