Creating a web page shortcut on the desktop using intune

In this blog I want to explain how you can create a shortcut to a website on the desktop with the help of Intune. You can use this for example to make the opening of your company’s intranet site or web application faster and easier for the users.

All the scripts I use in this blog can be found in my Git repository: Create-DesktopShortcut

Creating the desktop shortcut

With the following script you can create a shortcut file: Create-ShortcutFile.ps1

Before you run this script you have to edit it. For this adjust the following variables:

#Name of the shortcut
$shortcutName = "Intranet Shortcut" 
#Icon file best to use a website
$icon = "https://jannikreinhard.files.wordpress.com/website.ico"
#Link of the webseite
$websiteUrl = "https://jannikreinhard.com/"
#OutputFolder
$outputFolder = "C:\temp"

Hint: If you want to use the Windows shell icons you can do this with the following path in the icon variable.

%SystemRoot%\System32\SHELL32.dll,27

Once you have adjusted these variables you can create the .lnk file by running the script. You will find this file in the path you specified in the $outputFolder variable.

Creating the needed Scripts

We need to create 3 scripts to deploy the application through Intune. An installation, uninstallation and detection script is needed. Where you can find the scripts and how you need to customize them I will explain now.

Installation Script

To copy the shortcut to all users desktop we have to create the installation powersehll script. This script can be found here.

#Name of the shortcut
$shortcutName = "Intranet Shortcut" 

$ScriptPath = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Definition)

Copy-Item -Path "$ScriptPath\$shortcutName.lnk" -Destination "$Env:Public\Desktop"

Edit this script and insert the name you chose for the shortcut into the $shortcutName variable.

#Name of the shortcut
$shortcutName = "Intranet Shortcut" 

Deinstallation Script

After this script is created we need an uninstallation script. You can also find this in my repository.

#Name of the shortcut
$shortcutName = "Intranet Shortcut" 

Remove-Item -Path "$Env:Public\Desktop\$shortcutName.lnk"

Also here the $shortcutName variable must be adjusted.

#Name of the shortcut
$shortcutName = "Intranet Shortcut" 

Detection Script

Here you can find the detection script: Get-DesktopShortcut.ps1

#Name of the shortcut
$shortcutName = "Intranet Shortcut"  

if (Test-Path -Path "$Env:Public\Desktop\$shortcutName.lnk"){
    Write-Output "0"
}

The name of the shortcut must also be entered here.

#Name of the shortcut
$shortcutName = "Intranet Shortcut" 

Creating the Intune application file

How to create an Intune Application (.intunewin file) I have explained in detail in my blog using the CMtrace example. You can also find more information in the Microsoft Docs.

  • Create a folder in which you can place the shortcut and the installation and uninstallation scripts.
  • Open a CMD as admin an run the following command:
.\IntuneWinAppUtil -c C:\temp\IntranetShortcut -s C:\temp\IntranetShortcut\Create-DesktopShortcut.ps1 -o C:\temp\

Creating the Win32 App in intune

  • Navigate to Apps -> Windows
  • Click Add
  • Select Windows app (Win32) as App type
  • Click Select app package file
  • Click upload und select the .intunewin file
  • Click OK
  • Give the application a name and customize the app information.
  • Click Next
  • Enter the following as installation and uninstallation command

Install Command:

%windir%\system32\windowspowershell\v1.0\powershell.exe -executionpolicy bypass -windowstyle hidden -file "Create-DesktopShortcut.ps1"

Unistall Command:

%windir%\system32\windowspowershell\v1.0\powershell.exe -executionpolicy bypass -windowstyle hidden -file "Delete-DesktopShortcut.ps1"
  • Change the Device restart behavior to No specific action
  • Click Next
  • Select 32-bit and 64-bit as Operation system architecture
  • Select a minimum OS Version

Hints: If you want to specify further requirements, such as minimum free disk space, you can do this in this step.
It is also possible to specify a file, a registry value or a script as a requirement.

  • Select Use a custom detection script as Rules format
  • Upload the detection script
  • Click Next
  • We can skip the depentencies and supersedence step click next.
  • Add a assignment. In my example I have selected all default devices.
  • Click Next > Create

Now the shortcut is distributed to all computers in the group. As soon as the application package has arrived and is installed on the computers, you should find the shortcut on the desktop.

Stay healthy, Cheers
Jannik

13 thoughts on “Creating a web page shortcut on the desktop using intune

  1. Why take the extra steps of making it an App? Why not just apply it as a Script Policy and skip all the Win32 App fluff?

    Like

    • Hey Matt, that is also a way depends only on how you want to structure your Intune tenant. I find it more appropriate that when I create a shortcut on the device that I also see this as an app.

      Like

  2. I do not even know how I ended up here, but I thought this
    post was good. I do not know who you are but definitely you are going to a famous blogger
    if you aren’t already 😉 Cheers!

    Like

  3. Woah! I’m really digging the template/theme of this site. It’s simple,
    yet effective. A lot of times it’s challenging to
    get that “perfect balance” between superb usability and appearance.
    I must say you’ve done a amazing job with this. Also, the blog loads
    very quick for me on Firefox. Exceptional Blog!

    Like

  4. I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you
    hire out a developer to create your theme? Great work!
    server administration services (servermanagers.ng)

    Like

  5. Excellent web ѕite. Plenty of helpful info
    here. I am sending it to several buddies ans also sharing in deliciouѕ.
    And naturally, thаnk you іn your effort!

    Like

  6. My friend TY! I was able to successfully test this!! I’ll be following you and stalking your blog for additional valuable information. :o)

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s