Deploy Internet Shortcut with custom icon via Intune using Win32App

When we as IT People deploy Windows 10 AutoPilot we often get the feedback from users that they miss their shortcuts for SharePoint and such. For that reason I have created a manual which you can use to deploy this using a Win32App.

Preparation

Create a folder where you store the files that you need to deploy. For example:

I am deploying a shortcut for my SharePoint Online environment. To deploy this shortcut I need to following files:

The install.cmd cointains the following code:

First we create 2 folders:
– C:\ProgramData\AutoPilotConfig
– C:\ProgramData\AutoPilotConfig\Icons

I always create these folders to run and store installation/removal scripts. For example, when you have a custom application which requires a custom removal script this is where I store these scripts.

After that we copy the 2 files to these folders and last but not least we run the Powershell script. This script contains this code:

If you want to deploy another Internet Shortcut then SharePoint Online please edit these values:

$path, is the value where the SharePoint is being stored.
$targetpath, is the URL where you want to lead the Shortcut too.
$iconlocation, is the value where the icon is stored.

Change these values and put another iconfile in the folder that you are going to package.

Packaging

We are going to use WinAppUtil. This application is needed to package applications in Microsoft Intune. You can download it here: Link

Open Powershell, run the WinAppUtil.exe and use the following values:

Deployment

Log on to the Intune Portal at https://devicemanagement.microsoft.com/

Go to Apps:

After that go to Windows and add an App:

Add a Win32App:

Select app package file and browse to the SharePointShortCut.intunewin file.

Specify the package information:

Specify the installation instructions:

Install command: “Install.cmd”
Uninstall command: del /f “C:\Users\Public\Desktop\SharePointOnline.url”
Device restart behavior: “no specific action”

Specify the requirements:

Use the following detection rule:

No depencies and no scope tags are assigned.

Assign the groups that need the application:

And we are done!

If you have any questions don’t hesitate to ask.

Regards,

Niels

Related Posts

18 thoughts on “Deploy Internet Shortcut with custom icon via Intune using Win32App

  1. Hello Niels, thank you for this well-explained tutorial! I would like to know: is it possible to use this script to make a shortcut to a local folder? We use OneDrive Automount and I would like to automaticly place shortcuts to those folders. Thank you in advance!

    1. Hi Martijn,

      Thanks, I like to see that you used my post.

      You could use this script to create a shortcut to a folder:

      $create_shortcut = (New-Object -ComObject WScript.Shell).CreateShortcut
      $s = $create_shortcut.invoke(“c:\test.lnk”) # Must end in .lnk
      $s.TargetPath = “C:\temp”
      $s.IconLocation = “imageres.dll,3” # This is a reference to a folder icon
      $s.Description = “My Folder”
      $s.Save()

      If you have any questions don’t hesitate to ask!

      Niels

      1. Hi Niels,

        Is it possible to put the icon file to a sharepoint folder or site? will there be permission access issue?

        1. Hi,

          I think you have answered you own question. There will be a permission issue and the site is not directly available when deploying the machine for the first time.

          Kind Regards,

          Niels

  2. Hi Niels,
    Thank you very much for the post.
    The only thing i would like to say is that the deletion did not work for me. For some reason it fails all the time.

  3. Great post. I have added the THis PC shortcut and the network shortcut but the icons are not correct. I have googled and I can not find the correct icons. Any ideas?

  4. Hi Neils,

    Is there a way to put the icon in a centralized location so that the shortcut icon will appear regardless the pc in on the network or not?

      1. Hi Neisl,

        we just use the “install.cmd” command as a paramenter but we do not upload this script anywhere in the win32 process.

        1. Hi Max,

          You need to package this file within your Win32App creation process. Make sure to package the folder with all the files in it.

          Kind Regards,

          Niels

  5. I tweaked the icon part as it was not updating to the icon itself.

    $null = $WshShell = New-Object -comObject WScript.Shell
    $path = “C:\Users\Public\Desktop\My Link.lnk”
    $targetpath = “Link to some exe or url”
    $Shortcut = $WshShell.CreateShortcut($path)
    $Shortcut.TargetPath = $targetpath
    $Shortcut.IconLocation = “C:\ProgramData\AutoPilotConfig\Icons\Mylinkicon.ico,0”
    $Shortcut.Save()

Leave a Reply

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