
Launch a website using the default browser after a user logs on a Windows device
A question I often ask myself is: What do users want? In terms of their work environment, I believe that they want a device that “just works”. A device that does not hinder, but supports them in their daily operations. One that that immediately presents the user with the information that he/she is looking for.
The company I work for and I believe in simplifying access to information and applications, by combining everything that an end user needs to be productive directly, delivered to them from one online web app.
That is why it is important that this online workspace is available immediately when a user logs on to their device.
A while ago I saw the question “How to automatically open Microsoft Edge when a user logs in” asked in the Microsoft Intune forums on Technet.
As I already had a script running for several of our customers, of which I believed did just that, I uploaded my “Launch browser with a specific URL after a user logs on to a device” PowerShell script on the Technet Gallery, shared it with NeilCardan, and glady, it answered his question!
Now, exactly one year after I published my first blog post, i’m happy to share this solution on my blog too!
Invoke-LaunchBrowserAfterLogOn.ps1
The PowerShell script below will add a shortcut in the %ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\StartUp directory. All shortcuts in this directory will launch after a user logs in to a Windows device.
As the shortcut will be created in the %ALLUSERSPROFILE% directory, it will launch for any user that logs on the device.
param(
[string]$ShortcutName = "My Apps",
[string]$ShortcutUrl = "https://myapps.microsoft.com",
[string]$ShortcutIconLocation = "https://www.microsoft.com/favicon.ico"
)
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut("$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\Startup\$ShortcutName.lnk")
$Shortcut.TargetPath = $ShortcutUrl
if ($ShortcutIconLocation) {
$Shortcut.IconLocation = $ShortcutIconLocation
}
$Shortcut.Save()
Make sure to configure the script to run in SYSTEM context to write to the %ALLUSERSPROFILE% directory, and assign it to devices.
If you have any questions or feedback, please don’t hesitate to reach out to me using the comments section below, or on Twitter @jseerden.
5 thoughts on “Launch a website using the default browser after a user logs on a Windows device”
Hi John,
Thank you for this simple solution. Is it also possible to launch Edge with three tabs (three URLs) to open?
Kind regards,
Jef
Hi Jef,
Thanks! And I think the solution to that question is simple too! Just create three PowerShell Scripts that individually create a different shortcut. All three of them will launch in different tabs using the default browser.
I don’t think you’ll be able to define the order of the tabs that way though. A different approach would be to configure the startup tabs with policies and just put a shortcut for the browser in the startup folder!
Regards,
John
Hi,
Thanks for the useful PS script, one query I have that I hope you can help with.
Upon first use this causes the ‘How do you want to open this’ dialogue box to pop up (default app box).
Edge is set to default so I’m unsure why it is asking, can you offer any thoughts\advise?
Thanks, Matt
Hi John,
Is there any way to make it open the desired page just once after the first login? Thinking about a simple onboarding welcome screen
Hi Patryk,
You could use the “RunOnce” registry key to launch the default browser with a specific page just once.
Best regards,
John