18 May, 2022

How to deploy custom URL shortcuts with Microsoft Intune

This article will describe how to deploy custom URL shortcuts with Microsoft Intune.

Welcome to my first post in my “Cases from the Field” series. This series will describe things I’ve done during the projects I’ve worked on as a Modern Workplace Consultant.

Let me briefly describe what our customer requested. They use 2 web applications and want them as a URL shortcut on their Windows 10 enrolled device. Instead of doing this manually for all their devices, they asked if it is possible to do this with Microsoft Intune.

To make this possible I’ve deployed a Powershell script with Microsoft Intune. The script is very simple:

$new_object = New-Object -ComObject WScript.Shell
$destination = $new_object.SpecialFolders.Item("AllUsersDesktop")
$source_path = Join-Path -Path $destination -ChildPath "\\Salesforce.url"
$source = $new_object.CreateShortcut($source_path)
$source.TargetPath = "http://login.salesforce.com"

This Powershell script creates a custom URL shortcut and places it in the Public Desktop folder of your Windows 10 device. In this case, it will place a URL shortcut “Salesforce” and this will go to https://login.salesforce.com/


How to deploy custom URL shortcut with Microsoft Intune

Now let me show you how to deploy this Powershell Script with Microsoft Intune.

Step 1: Create a Powershell Script

Copy the code above and copy it into an editor like Powershell ISE or Visual Studio Code.
Change the following as preferred (in this example we will deploy Salesforce URL to our desktop).


Now save this PowerShell script to your local computer as a .ps1 file. I named it Create-Desktop-URL-Shortcuts.ps1.

Step 2: Deploy script with Microsoft Intune

Go to https://endpoint.microsoft.com and sign-in with a Global Administrator or Intune Administrator.

Go to Devices => Scripts. Then click on +Add and choose for Windows 10.


Give the Script a name. In this example it will be NDW – Add Custom URL shortcut to Desktop and click Next.


Choose the PowerShell script created and saved in Step 1. Leave the extra settings as default.


Assign it to All Devices or a group to those who need the deployment and click Next.


Review your settings and click Add. Your script will now be added.


Your script is now added and ready to deploy to the requested devices.

So this is how to deploy custom URL shortcuts with Microsoft Intune. Isn’t that difficult is it?

So this was the first post in my “Cases from the Field” series. Stay tuned for more…

Nicky De Westelinck

Nicky De Westelinck is a Modern Workplace Consultant for Wortell Belgium with several years of experience in Microsoft 365. His main focus is Microsoft EndPoint Manager and Microsoft 365 Administration. He is also a Microsoft Certified Trainer since 2021.

View all posts by Nicky De Westelinck →

16 thoughts on “How to deploy custom URL shortcuts with Microsoft Intune

  1. Any way to have this force use Internet Explorer? I have some legacy apps that only launch from IE.

      1. Hi. I too want to add a custom logo, but get this error after trying to add the additional line:

        Exception setting “IconLocation”: “The property ‘IconLocation’ cannot be found on this object. Verify that the property exists and can be set.

        Can you or any of your readers please suggest a fix?

  2. +My company has Android and Apple devices in Intune. I’ve been tasked with pushing a company website shortcut to all the Apple devices. I tried the script and it immediately says the uploaded file isn’t a valid script. Is there a wayto do this for iOs devices in Intune?

  3. Hi, thanks for the post. is there a universal repository of icons url hosted online that can be used to replace the internet explorer logo? If you know of any kindly point

  4. script is working fine but it is opening in Edge browser, Please suggest, how I can set it as Chrome instead of Edge.

  5. I would love to use this for creating shortcuts but, when I try to run the script in step 1 in an elevated Powershell window I just get the following error:-

    Unable to save shortcut “C:\Users\Public\Desktop\Salesforce.url”.
    At line:7 char:1
    + $source.Save()
    + ~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

    Any ideas on how to resolve this?

    Many thanks in advance.

    1. Hi Mike,
      Apologies for my late response, I was on vacation for two weeks. 🙂
      I just tried the script and (for some odd reason) I received the same error. I managed to get it working by changing the $destination variable to “Desktop” instead of “AllUsersDesktop”.
      This worked for me, here is the “new script”.

      $new_object = New-Object -ComObject WScript.Shell
      $destination = $new_object.SpecialFolders.Item(“Desktop”)
      $source_path = Join-Path -Path $destination -ChildPath “\\Salesforce.url”
      $source = $new_object.CreateShortcut($source_path)
      $source.TargetPath = “http://login.salesforce.com”


Leave a Reply

Your email address will not be published. Required fields are marked *