• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

Set IE11 as default in Windows 10 (once)

Hi all,

I need to make IE11 the default in Windows 10 for all staff.

The solutions Microsoft offer are not great and don't give us the flexability so I put together the below VBS script. This does work but I was wondering if it could either be managed better by powershell?

 If not I need help adding an option to create a registry key once the script has run once as the current user. On the next logon the script should then check if that value exists for that key and exit if it does.

Set WshShell = WScript.CreateObject("WScript.Shell")


' IE Default browser for WIN10
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=Internet%20Explorer"

' Give Default Programs time to load
WScript.Sleep 1200

' WshShell.AppActivate "Set Program Associations"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
'WScript.Sleep 500
WshShell.SendKeys " "

WScript.Quit

Open in new window


thanks
0
ranski
Asked:
ranski
  • 5
  • 2
  • 2
1 Solution
 
Austin TexasSystems EngineerCommented:
What is wrong with just letting it run on logon everytime?
0
 
ranskiAuthor Commented:
We want to allow staff who would prefer to use chrome the option of having that as the default. Our issue is that Edge doesn't support our internal systems.
0
 
McKnifeCommented:
Using sendkeys is prone to failure. It will try to act interactively and if the user uses the machine at the same time, it will fail.
I have not set a default browser on win10 using GPOs, but I know that we can assign all possible file types and protocols to IE. To do this, see an example for adobe pdf file types: https://www.adobe.com/devnet-docs/acrobatetk/tools/AdminGuide/pdfviewer.html
There, a machine is configured and then, the file type associations are simply exported using powershell and then this result xml file is deployed using GPOs. Please note that you can edit the result file so that only the file types that IE needs are enforced´to be run with IE11.
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
ranskiAuthor Commented:
Thanks. Yea I've used the default file association but it overwrites the users preference every time they log on.

If I use the above as a logon script do you still expect to see issues?
0
 
McKnifeCommented:
It overwrites them - so that is not what you intend? You don't intend to enforce IE as default browser? So you want to set it but users may change that?

Then use your script. Simply create a file object as marker that it has run like batch code
md %appdata%\admin\scripthasrun
and then make this the first line:
if exist %appdata%\admin\scripthasrun goto end

Sorry, I can offer no no vbs code for this.
0
 
ranskiAuthor Commented:
That's correct. By default Windows 10 sets Edge as the browser. This is incompatible with our homepage. Chrome and IE11 work fine.

I need to ensure that IE11 is the default browser but if someone wishes to have chrome as the default we still need to allow this
0
 
ranskiAuthor Commented:
I have updated the script slightly but can't get it to create the IESET folder. Can anyone help. Sorry i'm not great at vbs these days

Set oWS = WScript.CreateObject("WScript.Shell")
' Get the %userprofile% in a variable, or else it won't be recognized
userProfile = oWS.ExpandEnvironmentStrings( "%userprofile%" )

Dim objNetwork
Dim userName
Dim FSO
Dim Folder

Set FSO = CreateObject("Scripting.FileSystemObject")

Set objNetwork = CreateObject("WScript.Network")
userName = objNetwork.userName

If (FSO.FolderExists(userProfile + "\AppData\Roaming\IESET")) Then
End If


If NOT (FSO.FolderExists(userProfile + "\AppData\Roaming\IESET")) Then
    ' Delete this if you don't want the MsgBox to show
   ' MsgBox("Local folder doesn't exists, creating...")
    splitString = Split(userProfile, "\")

    ' Create folder
   ' MsgBox("C:\" + splitString(2) + "\AppData\Roaming\IESET")
    'FSO.CreateFolder(splitString(2) + "\AppData\Roaming\IESET")
	
	Set WshShell = WScript.CreateObject("WScript.Shell")

    ' force IE Default browser in Windows 10
    WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=Internet%20Explorer"

' Allow time for the Default Programs to load before sending next line of actions
    WScript.Sleep 1200

' WshShell.AppActivate "Set Program Associations"
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys " "
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys "{TAB}"
'WScript.Sleep 500
    WshShell.SendKeys " "

    'Msgbox "Default browser is now Internet Explorer."

    WScript.Quit
	
	
	End If

Open in new window

0
 
Austin TexasSystems EngineerCommented:
Probably because I am really old, I would typically do this in a batch file using 'IF EXIST c:\flag.txt'
Something like this:
if exist c:\flag.txt (
    rem file exists
) else (
    rem file doesn't exist so set the flag and run VBS
    echo Script run. > c:\flag.txt
    cscript IE10set.vbs
)

Open in new window

0
 
ranskiAuthor Commented:
Managed to fix it myself. Thanks all
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now