Firefox is the default browser for all users

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Matthew
Messages: 14
Registration: September 19, 2016 - 8:50 p.m.

September 19, 2016 - 9:01 PM

Hello,
I'd like to set up a package that restores Firefox as the default browser for all users on a computer.
After some research and testing on one machine, the most effective command seems to be
`C:\Program Files\Mozilla Firefox\uninstall\helper.exe /SetAsDefaultGlobal`.

So I created a package that runs this command with:
`run(r'C:\Program Files\Mozilla Firefox\uninstall\helper.exe /SetAsDefaultGlobal')`.

However, it seems to work on some machines but not others.

After investigating, I suspect it's related to User Account Control (UAC).
I therefore modified the registry before running the command, but it appears that a restart is required for the command to take effect.

My question is: I plan to create two packages: the first disables UAC, and the second restores Firefox as the default browser. How can I ensure a restart occurs between the installation of the two packages?

Thank you

, Matthieu
User avatar
Challans Town Hall
Messages: 15
Registered: July 7, 2014 - 3:52 PM

September 22, 2016 - 5:41 PM

Good morning,

Here are the commands to integrate into your setup.py to do this:

For x64 systems:

Code: Select all

"C:\Program Files (x86)\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal
For x86:

Code: Select all

"C:\Program Files\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal
To help you build the script, you may need the functions below:

Code: Select all

makepath(programfiles32,'Mozilla Firefox','uninstall','helper.exe')
As well as the example below for concatenating and running the command

Code: Select all

command = r"powershell -NoProfile -NoLogo -NonInteractive -Command import-startlayout -layoutpath screenlayout.bin -mountpath "
path = os.path.normpath('C:\\')
commandsm = ''.join([command,path])
run(commandsm)
Problem observed:
Some Windows updates reset Internet Explorer to default
So, a word of advice: create this package independently of the name, using `tis-firefoxdefaultall`, and place it as a dependency on the main Firefox package
Because this way, to restore Firefox to default, you just need to regenerate a version of tis-firefoxdefaultall which will restore Firefox to default without reinstalling Firefox.
Matthew
Messages: 14
Registration: September 19, 2016 - 8:50 p.m.

September 23, 2016 - 9:55 PM

THANKS,
I'll be back with several tests.
If I understand correctly, this is what I need to write in the package:

Code: Select all

commande = makepath(programfiles32,'Mozilla Firefox','uninstall','helper.exe')
parametre = '/SetAsDefaultAppGlobal'
commandsm = ' '.join([commande,parametre])
run(commandsm)
Why can't I just do it?

Code: Select all

run(r'C:\Program Files (x86)\Mozilla Firefox\uninstall\helper.exe /SetAsDefaultAppGlobal')
?
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

March 22, 2018 - 10:51

Has anyone succeeded?

The code

Code: Select all

            commande = makepath(programfiles,'Mozilla Firefox','uninstall','helper.exe')
           parametre = '/SetAsDefaultAppGlobal'            
           commandsm = ' '.join([commande,parametre])
            run(commandsm)
makes me:
CalledProcessErrorOutput: Command 'C:\\Program Files\\Mozilla Firefox\\uninstall\\helper.exe /SetAsDefaultAppGlobal' returned non-zero exit status 1.
Output: 'C:\Program' is not recognized as an internal
or external command, operable program or batch file.


and a simple run

Code: Select all

run_notfatal(r'"C:\Program Files\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal')
yields: FATAL ERROR: CalledProcessErrorOutput: Command '"C:\\Program Files\\Mozilla Firefox\\uninstall\\helper.exe" /SetAsDefaultAppGlobal' returned non-zero exit status 2.
Output:
Exit code: 3
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

March 22, 2018 - 11:00

Good morning,

While reading: http://kb.mozillazine.org/Default_browser#Windows

Code: Select all

firefox.exe -silent -setDefaultBrowser
Seems more appropriate. Launch it in the session_setup() section of the Firefox package and it should work for all users.

For those interested, Firefox 60 is coming this summer with a set of GPO templates that can be integrated into AD (ADMX files): Alexander
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

March 22, 2018 - 11:12

Sorry to be a pain, but the following code:

Code: Select all

run(r'"C:\Program Files\Mozilla Firefox\firefox.exe" -silent -setDefaultBrowser"')
yields:
FATAL ERROR: CalledProcessErrorOutput: Command '"C:\\Program Files\\Mozilla Firefox\\firefox.exe" -silent -setDefaultBrowser"' returned non-zero exit status 1.

I'm moving the quotation marks and apostrophes around, but nothing is working...
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

March 22, 2018 - 11:33

The last quotation mark is unnecessary
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

March 22, 2018 - 11:39

Ah yes, indeed, but even after correcting it I still have an error...

Code: Select all

run(r'"C:\Program Files\Mozilla Firefox\firefox.exe" -silent -setDefaultBrowser')
FATAL ERROR: CalledProcessErrorOutput: Command '"C:\\Program Files\\Mozilla Firefox\\firefox.exe" -silent -setDefaultBrowser' returned non-zero exit status 1.
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

March 22, 2018 - 2:39 PM

Good morning,

Would it be possible to install Firefox 32 on the posts?

The call path would then be C:\Program Files (x86\Mozilla Firefox\

I wasn't up to date on the new procedure for setting the default browser in Windows 10:
I haven't found any other functional "scriptable" methods under Windows 10 for Firefox, except by using a third-party executable: https://github.com/sampalmer/set-default-browser

Worth testing, but it's preferable to use a GPO.

Alexander
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

March 22, 2018 - 2:49 PM

Until yesterday, I was installing a 32-bit Firefox package everywhere, but the latest "lesfourmisduweb" packages uninstalled this 32-bit version and installed the 64-bit one. A folder called "C:\Program Files (x86)\Mozilla Firefox" remains on the computers, but it's almost empty.
And there's no longer a default browser on the computers, so users can no longer open website shortcuts on their desktops...
Last edited by gaelds on March 22, 2018 - 2:52 PM, edited 1 time.
Locked