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
[…] one of my last posts I explained how to create a desktop shortcut using a Win32 app. Now I want to show you a way how you can deploy a web shortcut for the Web Company Portal as an […]
LikeLike
step one is not creating the .ink file is there something missing in the script powershell doesnt create a error.
LikeLike
The code in this blog is only an part of the script. The script is located here: https://github.com/JayRHa/Intune-Scripts/blob/main/Create-DesktopShortcut/Create-ShortcutFile.ps1
LikeLike
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?
LikeLike
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.
LikeLike
Sounds good! I was just curious if I was missing a ‘best practice’. I thought about it over the weekend and I suppose the upside here is you’re presetting your removal of the icons, as I don’t believe the script policy would remove icons when the policy is no longer applied.
LikeLike
Yes that is completely correct. The script creates the shortcut but when this is no longer applied then the icon is not removed. Think for this an application is better. But Microsoft is currently working to support this ootb: https://docs.microsoft.com/en-us/mem/intune/fundamentals/in-development
LikeLike
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!
LikeLike
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!
LikeLike
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)
LikeLike
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!
LikeLike
My brother recommended I might like this blog. He was once entirely
right. This put up actually made my day. You can not imagine just how so much time I had spent for this information! Thanks!
microsoft azure management services
LikeLike
My friend TY! I was able to successfully test this!! I’ll be following you and stalking your blog for additional valuable information. :o)
LikeLiked by 1 person
When I run the Create-ShortcutFile.ps1 The shortcut file created doesn’t have the image like you show in this blog post. Is there something missing that make it? I verified my blobstorage link works etc.
LikeLike