Advanced deployment of web links with Intune

Advanced deployment of web links with Intune

Update 07/09/2020

This blog post has a revamped blog post available at https://srdn.io/2020/07/advanced-deployment-of-shortcuts-to-web-apps-with-microsoft-intune-revamped/ that contains a more robust and recommended Win32 app solution for deploying your shortcuts to web apps!

Original post

Intune supports a variety of app types app types, including web apps. Unfortunately, the settings you can configure when deploying a web link to Windows 10 devices with Intune are limited. Fortunately, PowerShell scripts can be also be used with Intune to deploy web links to these devices, which take away the limitations described in this post.

When deploying a web link to Windows 10 devices that is configured from the Client Apps > Apps pane in Intune, the web link is limited to:

  • Opening using the Default Browser;
  • Showing the Default Browser’s icon;
  • Adding the shortcut only to the Start Menu;

By using PowerShell scripts to deploy a web link, you can:

  • Specify which Browser should be used to open the web app;
  • Add a custom Icon to the web app’s shortcut;
  • Specify if the shortcut is added to the User’s desktop and/or Start Menu;

I have published three PowerShell scripts to the TechNet Gallery, which can be used to:

  1. Deploy a web link using the default browser;
  2. Deploy a web link using Edge as browser;
  3. Deploy a web link using Google Chrome as browser;

How to deploy a web link using the PowerShell script?

  1. Modify the parameter values to your needs;
    param(
        [string]$ShortcutName         = "My Apps",
        [string]$ShortcutUrl          = "https://myapps.microsoft.com",
        [string]$ShortcutIconLocation = "https://www.microsoft.com/favicon.ico",
        [bool]$ShortcutOnDesktop      = $true,
        [bool]$ShortcutInStartMenu    = $true
    )
  2. Upload the PowerShell script to Intune;
  3. Set Run this script using the logged on credentials to Yes in the PowerShell script settings.
  4. Assign the PowerShell script to one or more Azure Active Directory groups that contain the users whose devices receive the script;

38 thoughts on “Advanced deployment of web links with Intune

  1. Can you add multiple shortcuts in the same script or do you need one script per shortcut?

    Thanks again for this.

    1. Hi Michael,

      You can combine multiple shortcuts in a single script.

      I would separate this myself, so you can track the deployments individually and be able to target different groups of users and/or devices per shortcut.

  2. I am trying to inject links onto the start menu of a shared computer. The script works for me on computers that are logged in with a user but on our computers that are “Kiosk” and only ever have guest accounts logged in the links don’t show up. Is this possible?

    1. Hi Leifit,

      As there is no user that logs on to the device, you will have to modify the paths where the shortcut is created, so that they are stored in a system location instead of a user’s profile.

      You can replace:
      $Shortcut = $WScriptShell.CreateShortcut("$env:USERPROFILE\Desktop\$ShortcutName.lnk")
      with
      $Shortcut = $WScriptShell.CreateShortcut("$env:PUBLIC\Desktop\$ShortcutName.lnk")

      and

      $Shortcut = $WScriptShell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\$ShortcutName.lnk")
      with
      $Shortcut = $WScriptShell.CreateShortcut("$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\$ShortcutName.lnk")

      Also, you will have run the script in SYSTEM context and assign the PowerShell script to devices instead of users for it to be deployed.

      Regards,

      John

      1. I have modified everything as you said above. I also had to change the save location as that needed to be a shared location as well. The script deploys successfully but no shortcut ever shows up. Any ideas?

  3. Hi,
    I tried to deploy the script with Intune, I received a “suceeded” status but I don’t see the shortcut on my laptop yet. Do I have anything else to do ?

    thank you

    1. Hi Alexandra,

      Are you sure you run the script using the logged on user credentials? If the script runs as system, it will also succeed, but it won’t save the shortcut to the currently logged in user’s profile.

      Regards,

      John

  4. Hi!

    Great articel! I have tried the script but it only creates a shortcut in the start menu. Not on the desktop? We use shared device mode in Intune. Any thoughts?

    Thanks!

    1. Hi Simon,

      If the variables are set correctly it should also create the shortcut on the desktop, however, I have not tested this with Shared PC mode.

      Regards,

      John

  5. Hi,

    I tried follow your instructions to deploy the script with intune and I received a Succeeded, but the shortcut does not appear on the desktop or in the Start Menu. I have Run this script using the logged on credentials set to Yes per your instructions. Any ideas as to what I am doing wrong?

    1. Hi Svet,

      Maybe there are some configurations in place that are blocking the creations of shortcuts (in the right directory). I’m thinking maybe OneDrive Known Folder Move might be in place which could cause that. When I wrote this post I didn’t have that configured. You could try to use [Environment]::GetFolderPath(“Desktop”) instead of $env:USERPROFILE\Desktop or check out my reply to Leifit to deploy shortcuts in SYSTEM context instead of user.

      Regards,

      John

    1. Hi Thomas,

      This code block should help you create a shortcut with Internet Explorer

      $WScriptShell = New-Object -ComObject WScript.Shell

      if ($ShortcutOnDesktop) {
      $Shortcut = $WScriptShell.CreateShortcut("$env:USERPROFILE\Desktop\$ShortcutName.lnk")
      $ShortCut.TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
      $Shortcut.Arguments = $ShortcutUrl
      $ShortCut.WorkingDirectory = "C:\Program Files (x86)\Internet Explorer"
      $Shortcut.Arguments = $ShortcutUrl
      if ($ShortcutIconLocation) {
      $Shortcut.IconLocation = $ShortcutIconLocation
      }
      $Shortcut.Save()
      }

      Regards,

      John

  6. Will this script be executed everytime a user logs on? Does it overwrite the existing icons every time?

      1. Hi John,

        Thanks, that’s a great article. I’ve been using this script for the devices and it works perfectly (thanks again). However I also configured OneDrive KFM.
        Now when a users logs on to a new device the script is executed and seems to create a shortcut copy. How could I check in my script whether the shortcut already exists in the dekstop folder?

        Thank you!

        1. I found a solution with an if Testpath but when testing the script locally I noticed the script overwrites existing shortcuts so the problem must be related to the way OneDrive syncs files and not to this script.

          Thanks though! 🙂

  7. Hi. This script does not work anymore. It runs successfully, creates the shortcut on the desktop but it removes it again instantly. It worked last week, could it be some new windows updates that has broken it?

  8. I tried the script with Intune.

    I saw in Intune that it runed succesfully. But there is no Shortcut on the desktop or Startmenu.

    Do I have something to change the script with working the Known file move?

    1. Hi MAurits,

      Maybe there is something like OneDrive Known Folder Move in place? The scripts can use some improvements.

      For now, what happens if you for instance replace $Shortcut = $WScriptShell.CreateShortcut(“$env:USERPROFILE\Desktop\$ShortcutName.lnk”) with $Shortcut = $WScriptShell.CreateShortcut(“$([Environment]::GetFolderPath(“Desktop”))\$ShortcutName.lnk”) script using the default browser?

      Would be happy to hear the results.

      Best regards,

      John

  9. Please, put a sample of code to install multiple links, for example, secured and non-secured web links on a single script.

  10. Hi,

    Thanks for the helpful content.

    Is there anyway to get the icon to work without a favicon/.ico file?

    Tried uploading different images, but haven’t had luck getting them to work.

    Thanks

Leave a Reply

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