SOLVED

Creating desktop shortcuts

Steel Contributor

Hi all, 

 

How to I create desktop shortcuts via intune? Which go to specific sites? 

 

Any ideas? 

24 Replies

@AB21805 

 

I've used Powershell scripts to do this in the past. I did a quick bing search and found someones notes on how to do this

 

https://www.nickydewestelinck.be/2021/03/09/how-to-deploy-custom-url-shortcuts-with-microsoft-intune....

 

 

 

@AB21805 

 

You could take a look at what I did while creating a shortcut to a rdp file on a specific folder. You could skip the rdp part and just change the $targetpath = "c:\program files (x86)\rdp\remoteapp.rdp"

To the website you want

 

Remote App: The Last Whish - Call4Cloud

 

Soooo something like this

 

$null = $WshShell = New-Object -comObject WScript.Shell
$path = "C:\Users\Public\Desktop\call4cloud.url"
$targetpath = "https://www.call4cloud.nl"
$iconlocation = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
$iconfile = "IconFile=" + $iconlocation
$Shortcut = $WshShell.CreateShortcut($path)
$Shortcut.TargetPath = $targetpath
$Shortcut.Save()

Add-Content $path "HotKey=0"
Add-Content $path "$iconfile"
Add-Content $path "IconIndex=0"

@Rudy_Ooms_MVP Thank you! I will give this a try! and close once I give it ago! 

Thank you!

Hi @Rudy_Ooms_MVP 

 

Here is my script but it fails! any ideas? I have put the url in for a sharepoint location (Target path)

 

Screenshot 2021-09-06 at 2.07.19 PM.pngScreenshot 2021-09-06 at 2.30.58 PM.png

In the screenshot I am missing a " ?
Am I missing it at the end? Anywhere else?

So far As I see now.. the last " after iconindex=0

Add-Content $path "IconIndex=0"
Hi Rudy, still no luck and fails after adding the " where you said? ANy ideas?

Hi so after trying to run the script on the machine manually it works! But when I try deploying via intune it fails! How do I get it to succeed via intune? Any ideas?

Thats odd... I will try to see what happens at my side ... can you post a screenshot of the powershell script settings ? (user/system / 64 bits etc)

 

UPDATE: The first run in a sandbox worked like expected... waiting for it to be deployed to my test device/testtenant

 

UPDATE: Also copy paste my script above into a ps1, uploading it to intune

Rudy_Ooms_0-1631078818816.png

 

And after syncing the device the shortcut popped up

@Rudy_Ooms_MVP 

 

Hi 

 

So after doing this script manually it fails: 

 

$null = $WshShell = New-Object -comObject WScript.Shell
$path = "C:\Users\Public\Desktop\youtube.url"
$targetpath = "https://www.youtube.com"
$iconlocation = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
$iconfile = "IconFile=" + $iconlocation
$Shortcut = $WshShell.CreateShortcut($path)
$Shortcut.TargetPath = $targetpath
$Shortcut.Save()

Add-Content $path "HotKey=0"
Add-Content $path "$iconfile"
Add-Content $path "IconIndex=0"
 
I have done this script and it works manually: 
 

#Create a wscript.shell object
$ComObj = New-Object -ComObject WScript.Shell

#Use the createshortcut method and assign to a variable
$ShortCut = $ComObj.CreateShortcut("$Env:USERPROFILE\desktop\youtube.url")

#Path to URL
$ShortCut.TargetPath = "http://www.youtube.com"

$ShortCut.Save()

 

But even though this works manually running it, it fails when deploying via intune!

 

I have using these settings: 

 

Screenshot 2021-09-08 at 9.56.55 AM.png

Screenshot 2021-09-08 at 10.04.03 AM.png

The group I have assigned this script to are devices not users

 

 

 

Any idea why this isnt working for me? 

 

Please help!

Hi... the first script (my script :P) is working like expected... when I run it manually 

 

Rudy_Ooms_0-1631094657517.png

 

But the second script i am noticing the variable :$Env:USERPROFILE\desktop\youtube.url

That means the script needs to be executed as the user... otherwise it will end up in the system desktop :) 

 

WHen using the first script manually ... do you receive an error ?

*do you have edge installed inside the program files folder?

*Can you check out the public desktop... are there any icons on it?  Maybe a gpo with conflicting settings?

Hi Rudy,

The error disappears to quickly to see what it says! haa All I manage to read is unable to..

I have however notices desktop in public folder is hidden? does this matter? although ther are icons in this folder.
Hi,

Can you first open powershell and copy paste the script in it line by line... hopefully you can get the error

Hi @Rudy_Ooms_MVP 

 

I have copied line for line seems like a permissions thing! I am logged in as a admin aswel! Do you know how I can fix this? 

 

 

Capture.PNG

@Rudy_Ooms_MVP 

 

Im wondering if its better to do it the Win32 way ? I just done understand this?

md "c:\program files (x86)\rdp"
copy .\rdp.ico "c:\program files (x86)\rdp\rdp.ico"
copy .\remoteapp.rdp "c:\program files (x86)\rdp\remoteapp.rdp"

Hi can you post the "outcome" of the ntfs permission tab from the public desktop folder? it looks like some permissions are missing

 

Do you mean this? If something needs changing can we do this via intune too for this to work? 

 

@Rudy_Ooms_MVP 

1 best response

Accepted Solutions
best response confirmed by AB21805 (Steel Contributor)
Solution
I guess so.. you can take a look at this blog of mine... it describes how I gave everyone full control to the public desktop... you can use it to change the interactive permissions i guess

https://call4cloud.nl/2021/01/public-desktop-icons-and-adminless-the-far-side-of-intune/

View solution in original post