📜 ⬆️ ⬇️

Mozilla Foundation Product Update

The free Mozilla Foundation Windows-based e-mail and Internet solutions have long been used in our organization — functional, convenient, and relatively stable.
And everything would be fine - but sooner or later the question arises about the automation of updating these products.
After surfacing the internet, it was possible to find out that there are several interesting ways to update.
One of them - creating your own update server - is generally a good way for everyone, but it wasn’t possible to figure it out right off the bat (if someone has the experience, share!). Available by reference .
I will tell you about another way.

So, we assume that we have a WIN-domain (we do not need group policies in this case) and we are going to update them on machines in the domain. For definiteness, choose Firefox (in the case of Thunderbird everything is identical).
Initially, we need to go to the update site and download the latest update archive, for example, for version 3.6 you can download it here . The site has two types of updates - incremental and full. We will use the full, because Incremental means that we have a previous version of the program (which is not the case in general).
Next, what we have to do is to rename this file to update.mar, create the folder \\ pdc \ netlogon \ packages \ firefox, where pdc is our domain controller. You will also need to create a installuser user with domain administrator authority.
Unfortunately, my method has a significant disadvantage - the password of this user will be stored in clear text in the .js file code.

The contents of the \\ pdc \ netlogon \ packages \ firefox folder will be as follows:
update.bat
psexec.exe
updater.exe
updater.ini
update.mar
psexec.reg

So, in order
update.bat :
mkdir "%PROGRAMFILES%\Mozilla Firefox" >>nul 2>&1 cd "%PROGRAMFILES%\Mozilla Firefox" %1\firefox-update\updater.exe %1\firefox-update 0 

')
psexec.exe is the one psexec. You can take it on the official website .

updater.exe - take in the folder with Firefox (I used version 1.8.1)

updater.ini is a small config for updater.exe:
; This file is in the UTF-8 encoding
[Strings]
Title= Firefox
Info= Firefox...
[PostUpdateWin]
ExeRelPath=uninstall\helper.exe
ExeArg=/PostUpdate


update.mar is the update file.

psexec.reg :
 REGEDIT4 [HKEY_CURRENT_USER\Software\SysInternals] [HKEY_CURRENT_USER\Software\SysInternals\PsExec] "EulaAccepted"=dword:00000001 


Next, we put in the netlogon setup_firefox_36.js file :
 var WshShell = WScript.CreateObject("WScript.Shell"); FSO = new ActiveXObject("Scripting.FileSystemObject"); //   ,  , //      Firefox var WshProcEnv = WshShell.Environment("PROCESS"); var strTEMP = WshProcEnv("TEMP"); var un = WshProcEnv("USERNAME"); var compname = WshProcEnv("COMPUTERNAME"); var pf = WshProcEnv("PROGRAMFILES"); var firefox_path = pf+"\\Mozilla Firefox"; // ,  IP   //    var pdc = "192.168.1.200"; var domain = "OUR_DOMAIN"; //    -  .   //   ,     -    //       var version = /3\.6\./; //     //      users = new Array(); // users.push('katsy'); comps = new Array(); // comps.push('bdc'); //      -  for (i = 0; i < users.length; i++) if (users[i].toLowerCase() == un.toLowerCase()) WScript.Quit(); for (i = 0; i < comps.length; i++) if (comps[i].toLowerCase() == compname.toLowerCase()) WScript.Quit(); //      try { //   application.ini //   ,    <3 var re = new RegExp("^Version=(.*)$","i"); ForReading = 1; if (FSO.FileExists(firefox_path+"\\application.ini")) { f = FSO.OpenTextFile(firefox_path+"\\application.ini", ForReading); while (!f.AtEndOfStream) { str = f.ReadLine(); if (re.exec(str)) { if (version.exec(RegExp.$1)) WScript.Quit(); } } f.Close(); } } catch(e) {} //   firefox-update,   EULA  psexec -   psexec    //        try { FSO.CreateFolder(strTEMP+"\\firefox-update") } catch(e) {} // for EULA-accept import WshShell.Run("regedit -s \\\\"+pdc+"\\netlogon\\packages\\firefox\\psexec.reg",0,true); WshShell.Run("cmd /C copy /Y \\\\"+pdc+"\\netlogon\\packages\\firefox\\psexec.exe "+strTEMP+"\\firefox-update",0,true); WshShell.Run("cmd /C copy /Y \\\\"+pdc+"\\netlogon\\packages\\firefox\\updater.* "+strTEMP+"\\firefox-update",0,true); WshShell.Run("cmd /C copy /Y \\\\"+pdc+"\\netlogon\\packages\\firefox\\update.* "+strTEMP+"\\firefox-update",0,true); //   ,      ,  Mozilla FireFox   // if (FSO.FolderExists(firefox_path)) { WshShell.CurrentDirectory = strTEMP+"\\firefox-update"; WshShell.Run("psexec.exe -u "+domain+"\\installuser -p  cmd /C "+strTEMP+"\\firefox-update\\update.bat "+strTEMP,0,false); } 


And the last thing to do is to write a line in the login script for users:
start wscript \\ pdc \ netlogon \ setup_firefox_36.js

Source: https://habr.com/ru/post/96918/


All Articles