⬆️ ⬇️

Updating Mozilla Thunderbird extensions via GPO using the example of Lighting 1.02b



Not so long ago, I ran into a problem and / or inconvenience when updating the Lighting 1.02b extension for Mozilla Thunderbird.

1. When upgrading Thunderbird from 2.x.x to 3.x.x, the Lighting version installed in 2.x.x is not compatible with 3.x.x

2. When updating Thunderbird from version 2.xx to 3.xx, Lighting tries to update via the Internet.

3. When updating Thunderbird from version 2.xx to 3.x.x, Lighting is not always automatically updated (problems with the site from which the update is being downloaded)



It’s inconvenient to install this extension with your hands, especially when you have more than 100 users.

Writing instructions to the user how and what to do is also not an option.

The task was to update Lighting users through a GPO.

The task was successfully implemented.



It turns out that all Thunderbird extensions could be installed using the -install-global-extension key, but in Thunderbird, starting from version 3, this function is “removed”. Long searches brought to the original solution.

')

So, the points:

1. Download the Lighting extension

2. Unpack it, for example, with winrar

3. We look into the install.rdf file (which was recently unpacked) and in the section 'Description about = “urn: mozilla: install-manifest” “we are looking for the line' em: id '

4. Copy the ID number with quotes - we have this {e2fda1a4-762b-4020-b5ad-a41df1933103}

5. Create a directory and give it the name of the copied ID - {e2fda1a4-762b-4020-b5ad-a41df1933103}

6. Copy to this directory all the files that were previously unpacked from the extension

7. Create an empty file in this directory called update_light102b.txt to check the installed version of Lighting

8. Place a directory on the server that will be available to clients when updating



Now we need to copy this folder to the extensions folder of the Thunderbird program in the user profile.

Here you need to define the default profile of Thunderbird and copy our folder with the extension, while not forgetting to check whether it has already been installed.

I had to suffer a little, but the script was successfully written, applied in the GPO to the user's input.

The script does not pretend to originality - you can add it and adjust it as you like.

The script finds the default Thunderbird profile, then copies the extension if it has not been previously copied.



The script itself:

================================================= ==============================

Dim Profiles,Thunderbird,fileprefs,profile_ini

Dim ProfDirs, OldProfileFolder

Dim strSource, strSource3

Dim fso

Dim numprof

Const ForReading = 1



Set fso = CreateObject("Scripting.FileSystemObject")



Profiles = "Profiles\"

Thunderbird="Thunderbird\"

fileprefs = "prefs.js"

profiles_ini = "profiles.ini"

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

UserName = un.ExpandEnvironmentStrings ( "%USERNAME%" )

PathApps = un.ExpandEnvironmentStrings ( "%APPDATA%" ) & "\"

PathLocal = un.ExpandEnvironmentStrings ( "%USERPROFILE%" ) & "\Local Settings\Thunderbird\"



Public Function Find_profile

numprof = 0

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(PathApps & Thunderbird & profiles_ini, ForReading)

i = 0

Do Until objFile.AtEndOfStream

strLine1 = objFile.ReadLine

If InStr(strLine1, "Name=default") Then

i = i + 1

strLine1 = objFile.ReadLine

strLine1 = objFile.ReadLine

ProfDirs = Replace(strLine1,"Path=Profiles/","" )

OldProfileFolder = PathApps & Thunderbird & Profiles & ProfDirs & "\"

End If

Loop

numprof = i

objFile.Close

If numprof = 1 Then

Find_profile = OldProfileFolder

Else

Find_profile = ""

End If

End function



strSource = Find_profile + "extensions\{e2fda1a4-762b-4020-b5ad-a41df1933103}"

strSource2 = strSource + "\update_light102b.txt"



If fso.FileExists(strSource2) Then

else

fso.CopyFolder "\\server\distr$\Update_GPO\Lighting\{e2fda1a4-762b-4020-b5ad-a41df1933103}", strSource, true

end if


================================================= ===============================



Thus, you can update any extension in Thunderbird, with:

1. no extra traffic

2. no headache (refreshed or not)

3. no inconvenience to user



Materials used in finding the solution:

1. http://wpkg.org/Thunderbird#Silent_installation_of_Thunderbird_extensions

2. http://wpkg.org/Mozilla_Calendar/Lightning_for_Thunderbird_(global ) #Lightning_1.0_Beta_2_for_Thunderbird_3.1

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



All Articles