Deploy a desktop shortcut for a Microsoft Store app with Intune
To deploy a Microsoft Store shortcut to the desktop, we’ll need to create a PowerShell script with the following content:
$TargetFile = "C:\Windows\explorer.exe"
$ShortcutFile = "$env:USERPROFILE\Desktop\CompanyPortal.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.Arguments="shell:AppsFolder\Microsoft.CompanyPortal_8wekyb3d8bbwe!App"
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
In the Arguments line, note that I’m selecting the Company Portal app. If you’re interested in deploying another app but aren’t sure of the full name (the “_8weky…” part after CompanyPortal is required), press Winkey+r and run shell:AppsFolder to see all of the available apps:
Then in the file explorer window that appears, select one of the applications and drag it to the desktop:
Then open the properties of the shortcut to see the full name:
Once we have the PowerShell script ready, upload to Intune and deploy to the device. You can do this by going to the Microsoft Endpoint Manager admin center, selecting Devices > Scripts > +Add > Windows 10. Make sure that you’re also deploying the Microsoft Store app itself!
And then you should be good to go! Here’s how the desktop shortcut looks on my test device:
You’ll probably have noticed that the Icon for Company Portal is set to a File Explorer icon. To configure the icon location of the shortcut, add an additional line to the PowerShell script:
$Shortcut.IconLocation = "c:\LocationOfYourIcon.ico"
The problem is that Microsoft Store apps don’t expose the .ico (or .dll or .exe) file that can be used as an icon for a shortcut location. I’ve tried a few methods of extracting the icon on the fly but they simply produce a blank icon. If you’ve found a way to extract the icon during the script let me know!
One easy answer to the icon problem is deploying the icon as a Win32 app in Intune, copying it to the temp directory, and then running the script. If you’re interested in this approach, also comment below, and I’ll work on a follow up blog post.
The other easy answer is pointing the .IconLocation to a publicly available endpoint for the .ico. Like for example… https://deviceadvice.io/wp-content/uploads/2020/08/CompanyPortalApp.ico
Now our updated script will look like:
$TargetFile = "C:\Windows\explorer.exe"
$ShortcutFile = "$env:USERPROFILE\Desktop\CompanyPortal.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.Arguments="shell:AppsFolder\Microsoft.CompanyPortal_8wekyb3d8bbwe!App"
$Shortcut.IconLocation = " https://deviceadvice.io/wp-content/uploads/2020/08/CompanyPortalApp.ico"
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
And the deployed icon on the desktop:
As another short aside – it’s worth mentioning that this requires an Azure AD Joined or Hybrid Azure AD Joined device because of the Intune Management Extension (the Windows service Intune users to run scripts). Azure AD Registered devices (including devices enrolled via the Company Portal itself) won’t even receive the management extension. If you’re deploying Win32 apps you’ll also notice this – that devices need to be joined to Azure AD before they can install those applications, because the Intune Management Extension is doing the install.
And that’s all! Happy deploying! đźŹ
Hi Team!
Much appreciated for this articles, it really helps me. Idea is very simple – MS changed how portal.manage.microsoft.com is working and now it asks for your device every time you are logging in. Just imagine user’s nightmare – they used to open pinned via Intune link to portal and install apps – and now they have to “go to devices -> click on additional device message -> choose device even it is only device that you have->see list of apps”.
Official MS answer – we changed logics and now you have to live at this reality.
Solution:
1. download “Company portal app” using this manual https://docs.microsoft.com/en-us/mem/intune/apps/store-apps-company-portal-app and push it to all devices
2. create shortcut using your article
3. send email to all users that now they should use icon on desktop
Profit 🙂
Did you ever workout how to get the installed app’s icon?
Other than the method above (pointing to a public location), I haven’t found any other way to push the app icon.
Does the !App needs to be the App ID equivalent from AppxManifest.xml file?
I think so, yes
for the shortcut, though would have to change the path after any update… you could point it to the exe if the exe has an icon
$Shortcut.IconLocation = “C:\Program Files\WindowsApps\MicrosoftCorporationII.QuickAssist_2.0.6.0_x64__8wekyb3d8bbwe\QuickAssist.exe”