-
Notifications
You must be signed in to change notification settings - Fork 6
/
Update-MozillaFirefox.ps1
2175 lines (1776 loc) · 111 KB
/
Update-MozillaFirefox.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
Update-MozillaFirefox.ps1
Requires either (a) PowerShell v3 or later or (b) .NET 3.5 or later (at Step 8: JSON import and conversion).
Assumes that one instance (the latest non-beta version) of Mozilla Firefox is to be used. The script will exit at Step 15, if more than one instance of Firefox is detected.
Latest Firefox version numbers:
https://product-details.mozilla.org/
https://product-details.mozilla.org/1.0/firefox_versions.json
https://product-details.mozilla.org/1.0/thunderbird_versions.json
Languages:
https://product-details.mozilla.org/1.0/languages.json
Regions:
https://product-details.mozilla.org/1.0/regions/en-US.json
Release History:
https://product-details.mozilla.org/1.0/firefox_history_stability_releases.json
Download Latest Firefox Version URLs:
https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt
https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US
http://www.mozilla.org/firefox/organizations/all/
https://www.mozilla.org/en-US/firefox/all/
Check if the installed version of Firefox is the latest:
https://www.mozilla.org/en-US/firefox/new/
Uninstall Firefox:
https://support.mozilla.org/en-US/kb/uninstall-firefox-from-your-computer
https://wiki.mozilla.org/Installer:Command_Line_Arguments
#>
# Step 1
# Establish the common parameters
$path = $env:temp
$computer = $env:COMPUTERNAME
$ErrorActionPreference = "Stop"
$start_time = Get-Date
$empty_line = ""
$quote ='"'
$unquote ='"'
$firefox_enumeration = @()
$latest_firefox = @()
$after_update_firefoxes = @()
# Function to check whether a program is installed or not
Function Check-InstalledSoftware ($display_name) {
Return Get-ItemProperty $registry_paths -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like $display_name }
} # function
# Step 2
# Determine the architecture of a machine # Credit: Tobias Weltner: "PowerTips Monthly vol 8 January 2014"
If ([IntPtr]::Size -eq 8) {
$empty_line | Out-String
"Running in a 64-bit subsystem" | Out-String
$64 = $true
$bit_number = "64"
$registry_paths = @(
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
$empty_line | Out-String
} Else {
$empty_line | Out-String
"Running in a 32-bit subsystem" | Out-String
$64 = $false
$bit_number = "32"
$registry_paths = @(
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
$empty_line | Out-String
} # Else
# Step 3
# Determine whether Firefox is installed or not
$firefox_is_installed = $false
If ((Check-InstalledSoftware "*Firefox*") -ne $null) {
$firefox_is_installed = $true
} Else {
$continue = $true
} # Else
# Step 4
# Enumerate the existing installed Firefoxes
$32_bit_firefox_is_installed = $false
$64_bit_firefox_is_installed = $false
$registry_paths_selection = Get-ItemProperty $registry_paths -ErrorAction SilentlyContinue | Where-Object { ($_.DisplayName -like "*Firefox*" ) -and ($_.Publisher -like "Mozilla*" )}
If ($registry_paths_selection -ne $null) {
ForEach ($item in $registry_paths_selection) {
# Custom Values
If (($item.DisplayName.Split(" ")[-1] -match "\(") -eq $false) {
$locale = ($item.DisplayName.Split(" ")[-1]).Replace(")","")
} Else {
$continue = $true
} # Else
If (($item.DisplayName.Split(" ")[-1] -match "\(x") -eq $true) {
If ($item.DisplayName.Split(" ")[-1] -like "(x86") {
$32_bit_firefox_is_installed = $true
$type = "32-bit"
} ElseIf ($item.DisplayName.Split(" ")[-1] -like "(x64") {
$64_bit_firefox_is_installed = $true
$type = "64-bit"
} Else {
$continue = $true
} # Else
} ElseIf (($item.DisplayName.Split(" ")[-2] -match "\(x") -eq $true) {
If ($item.DisplayName.Split(" ")[-2] -like "(x86") {
$32_bit_firefox_is_installed = $true
$type = "32-bit"
} ElseIf ($item.DisplayName.Split(" ")[-2] -like "(x64") {
$64_bit_firefox_is_installed = $true
$type = "64-bit"
} Else {
$continue = $true
} # Else
} Else {
$continue = $true
} # Else
# $product_version_enum = ((Get-ItemProperty -Path "C:\Program Files (x86)\Mozilla Firefox\Firefox.exe" -ErrorAction SilentlyContinue -Name VersionInfo).VersionInfo).ProductVersion
$product_version_enum = ((Get-ItemProperty -Path "$($item.InstallLocation)\Firefox.exe" -ErrorAction SilentlyContinue -Name VersionInfo).VersionInfo).ProductVersion
$test_stability = $product_version_enum -match "(\d+)\.(\d+)\.(\d+)"
$test_major = $product_version_enum -match "(\d+)\.(\d+)"
If (($product_version_enum -ne $null) -and ($test_stability -eq $true)) { $product_version_enum -match "(?<C1>\d+)\.(?<C2>\d+)\.(?<C3>\d+)" | Out-Null } Else { $continue = $true }
If (($product_version_enum -ne $null) -and ($test_stability -eq $false) -and ($test_major -eq $true)) { $product_version_enum -match "(?<C1>\d+)\.(?<C2>\d+)" | Out-Null } Else { $continue = $true }
$firefox_enumeration += $obj_firefox = New-Object -TypeName PSCustomObject -Property @{
'Name' = $item.DisplayName.Replace("(TM)","")
'Publisher' = $item.Publisher
'Product' = $item.DisplayName.Split(" ")[1]
'Type' = $type
'Locale' = $locale
'Major Version' = If ($Matches.C1 -ne $null) { $Matches.C1 } Else { $continue = $true }
'Minor Version' = If ($Matches.C2 -ne $null) { $Matches.C2 } Else { $continue = $true }
'Build Number' = If ($Matches.C3 -ne $null) { $Matches.C3 } Else { "-" }
'Computer' = $computer
'Install Location' = $item.InstallLocation
'Standard Uninstall String' = $item.UninstallString.Trim('"')
'Release Notes' = $item.URLUpdateInfo
'Identifying Number' = $item.PSChildName
'Version' = $item.DisplayVersion
} # New-Object
} # foreach ($item)
# Display the Firefox Version Enumeration in console
If ($firefox_enumeration -ne $null) {
$firefox_enumeration.PSObject.TypeNames.Insert(0,"Firefox Version Enumeration")
$firefox_enumeration_selection = $firefox_enumeration | Select-Object 'Name','Publisher','Product','Type','Locale','Major Version','Minor Version','Build Number','Computer','Install Location','Standard Uninstall String','Release Notes','Version'
$empty_line | Out-String
$header_firefox_enumeration = "Enumeration of Firefox Versions Found on the System"
$coline_firefox_enumeration = "---------------------------------------------------"
Write-Output $header_firefox_enumeration
$coline_firefox_enumeration | Out-String
Write-Output $firefox_enumeration_selection
} Else {
$continue = $true
} # Else
} Else {
$continue = $true
} # Else (Step 4)
# Step 5
# Warn the user if more than one instance of Firefox is installed on the system
$multiple_firefoxes = $false
If ((($firefox_enumeration | Measure-Object Name).Count) -eq 0) {
Write-Verbose "No Firefox seems to be installed on the system."
} ElseIf ((($firefox_enumeration | Measure-Object Name).Count) -eq 1) {
# One instance of Firefox seems to be installed.
$continue = $true
} ElseIf ((($firefox_enumeration | Measure-Object Name).Count) -ge 2) {
$empty_line | Out-String
Write-Warning "More than one instance of Firefox seems to be installed on the system."
$multiple_firefoxes = $true
} Else {
$continue = $true
} # Else
# Step 6
# Check if the computer is connected to the Internet # Credit: ps1: "Test Internet connection"
If (([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet) -eq $false) {
$empty_line | Out-String
Return "The Internet connection doesn't seem to be working. Exiting without checking the latest Firefox version numbers or without updating Firefox (at Step 6)."
} Else {
Write-Verbose 'Checking the most recent Firefox version numbers from the Mozilla website...'
} # Else
# Step 7
# Check the baseline Firefox version numbers by connecting to the Mozilla website and write it to a file (The Baseline). Also download three additional auxillary JSON files from Mozilla.
# Source: https://groups.google.com/forum/#!topic/mozilla.release.engineering/EOyvryJNq7A
$baseline_url = "https://product-details.mozilla.org/1.0/firefox_versions.json"
$baseline_file = "$path\firefox_current_versions.json"
try
{
$download_baseline = New-Object System.Net.WebClient
$download_baseline.DownloadFile($baseline_url, $baseline_file)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $baseline_url"
If (([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet) -eq $true) {
$page_exception_text = "Please consider running this script again. Sometimes this Mozilla page just isn't queryable for no apparent reason. The success rate 'in the second go' usually seems to be a bit higher."
$empty_line | Out-String
Write-Output $page_exception_text
} Else {
$continue = $true
} # Else
$empty_line | Out-String
Return "Exiting without checking the latest Firefox version numbers or without updating Firefox (at Step 7)."
}
$history_url = "https://product-details.mozilla.org/1.0/firefox_history_stability_releases.json"
$history_file = "$path\firefox_release_history.json"
try
{
$download_history = New-Object System.Net.WebClient
$download_history.DownloadFile($history_url, $history_file)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $history_url"
If (([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet) -eq $true) {
$empty_line | Out-String
Write-Output $page_exception_text
} Else {
$continue = $true
} # Else
$empty_line | Out-String
Return "Exiting without checking the latest Firefox version numbers or without updating Firefox (at Step 7 while trying to download the history file)."
}
# https://product-details.mozilla.org/1.0/all.json
# https://product-details.mozilla.org/1.0/firefox.json
$major_url = "https://product-details.mozilla.org/1.0/firefox_history_major_releases.json"
$major_file = "$path\firefox_major_versions.json"
try
{
$download_major = New-Object System.Net.WebClient
$download_major.DownloadFile($major_url, $major_file)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $major_url"
If (([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet) -eq $true) {
$empty_line | Out-String
Write-Output $page_exception_text
} Else {
$continue = $true
} # Else
$empty_line | Out-String
Return "Exiting without checking the latest Firefox version numbers or without updating Firefox (at Step 7 while trying to download a file containing the major version release dates)."
}
$language_url = "https://product-details.mozilla.org/1.0/languages.json"
$language_file = "$path\firefox_languages.json"
try
{
$download_language = New-Object System.Net.WebClient
$download_language.DownloadFile($language_url, $language_file)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $language_url"
If (([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet) -eq $true) {
$empty_line | Out-String
Write-Output $page_exception_text
} Else {
$continue = $true
} # Else
$empty_line | Out-String
Return "Exiting without checking the latest Firefox version numbers or without updating Firefox (at Step 7 while trying to download the languages file)."
}
$region_url = "https://product-details.mozilla.org/1.0/regions/en-US.json"
$region_file = "$path\firefox_regions.json"
try
{
$download_region = New-Object System.Net.WebClient
$download_region.DownloadFile($region_url, $region_file)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $region_url"
If (([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet) -eq $true) {
$empty_line | Out-String
Write-Output $page_exception_text
} Else {
$continue = $true
} # Else
$empty_line | Out-String
Return "Exiting without checking the latest Firefox version numbers or without updating Firefox (at Step 7 while trying to download the regions file)."
}
Start-Sleep -Seconds 2
# Step 8
# Import the downloaded JSON files as objects
# Source: http://stackoverflow.com/questions/1825585/determine-installed-powershell-version?rq=1
# Source: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/convertfrom-json
# Source: https://blogs.technet.microsoft.com/heyscriptingguy/2014/04/23/powertip-convert-json-file-to-powershell-object/
# Source: http://powershelldistrict.com/powershell-json/
# Source: https://technet.microsoft.com/en-us/library/ee692803.aspx
# Source: http://stackoverflow.com/questions/32887583/powershell-v2-converts-dictionary-to-array-when-returned-from-a-function
<#
Update channels - Advanced
Updates can be retrieved from a number of different update channels. To check which channel you are on, look in about:config at app.update.channel. This determines what kind of updates you will receive. The current update channels are:
nightly: The nightly channel allows you to update to every nightly test build that is produced. There are nightly channels for the trunk (i.e., current release version plus 3 numbers); this is also a nightly channel for the remaining legacy branches (Firefox 3.6 & Thunderbird 3.1 builds).
aurora: This is a new channel which has been introduced with the rapid-release scheme; these builds reflect changes which also went into beta for the next release, thus making them available immediately, or which were deemed unsuitable for beta but safe for the following release (and, in general don't contain any string changes).
beta: The beta channel lets you receive every beta, release candidate, and release version of the product (e.g. Firefox 1.5 beta 1, Firefox 1.5 RC 1, Firefox 1.5, etc.). With the new rapid-release process (starting with Firefox/Thunderbird 5.0 and SeaMonkey 2.1), every beta is a release candidate for the next version now, and the actual release build is no longer provided on the beta channel.
esr: This is a special release channel for extended-support releases which are mostly targeting enterprise users. Features are frozen with every 7th or so update cycle and only security updates provided (i.e., Firefox/Thunderbird 10.0 ESR updates to 10.0.1, 10.0.2, ..., 10.0.x, then 17.0 as the next ESR branch).
default: This channel is used when there is no channel information, for example if you build Firefox or Thunderbird yourself. There are no updates on this channel. This channel is frequently used by Linux distributions, given that they provide own updates through their respective package-management system.
release: The release channel will provide stable release versions, including security updates (e.g. Firefox 2.0, 2.0.0.4 etc.).
Source: http://kb.mozillazine.org/Software_Update
#>
# Join the two files containing release dates
# Source: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/convertfrom-stringdata
# Source: https://technet.microsoft.com/en-us/library/ee692803.aspx
# $history_file_content = (Get-Content -Path $history_file)
# $major_file_content = (Get-Content -Path $major_file)
$history_conversion = [System.IO.File]::ReadAllText($history_file).Replace("}",", ")
$major_conversion = [System.IO.File]::ReadAllText($major_file).Replace("{","")
$all_firefox = [string]$history_conversion + $major_conversion
If ((($PSVersionTable.PSVersion).Major -lt 3) -or (($PSVersionTable.PSVersion).Major -eq $null)) {
# PowerShell v2 or earlier JSON import # Credit: Goyuix: "Read Json Object in Powershell 2.0"
# Requires .NET 3.5 or later
$powershell_v2_or_earlier = $true
If (($PSVersionTable.PSVersion).Major -eq $null) {
$powershell_v1 = $true
# LoadWithPartialName is obsolete, source: https://msdn.microsoft.com/en-us/library/system.reflection.assembly(v=vs.110).aspx
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
} ElseIf (($PSVersionTable.PSVersion).Major -lt 3) {
$powershell_v2 = $true
Add-Type -AssemblyName "System.Web.Extensions"
} Else {
$continue = $true
} # Else
$serializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer
$latest = $serializer.DeserializeObject((Get-Content -Path $baseline_file) -join "`n")
$history = $serializer.DeserializeObject((Get-Content -Path $history_file) -join "`n")
$major = $serializer.DeserializeObject((Get-Content -Path $major_file) -join "`n")
$all_dates = $serializer.DeserializeObject(($all_firefox) -join "`n")
$language = $serializer.DeserializeObject((Get-Content -Path $language_file) -join "`n")
$region = $serializer.DeserializeObject((Get-Content -Path $region_file) -join "`n")
try
{
$latest_release_date = (Get-Date ($all_dates.Get_Item("$($latest.LATEST_FIREFOX_VERSION)"))).ToShortDateString()
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} ElseIf (($PSVersionTable.PSVersion).Major -ge 3) {
# PowerShell v3 or later JSON import
$latest = (Get-Content -Raw -Path $baseline_file) | ConvertFrom-Json
$history = (Get-Content -Raw -Path $history_file) | ConvertFrom-Json
$major = (Get-Content -Raw -Path $major_file) | ConvertFrom-Json
$all_dates = ($all_firefox) | ConvertFrom-Json
$language = (Get-Content -Raw -Path $language_file) | ConvertFrom-Json
$region = (Get-Content -Raw -Path $region_file) | ConvertFrom-Json
try
{
$latest_release_date = (Get-Date ($all_dates | Select-Object -ExpandProperty "$($latest.LATEST_FIREFOX_VERSION)")).ToShortDateString()
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} Else {
$continue = $true
} # Else
# Had the release date not yet been resolved, convert the .json formatted dates to a hash table and try to figure out the date
# Source: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/convertfrom-stringdata
# Source: https://technet.microsoft.com/en-us/library/ee692803.aspx
If ($latest_release_date -eq $null) {
$raw_conversion = $all_firefox.Replace("{","").Replace(": "," = ").Replace(",","`r`n").Replace("}","`r`n").Replace('"','')
$release_dates = ConvertFrom-StringData -StringData $raw_conversion
$release_dates_list = $release_dates.GetEnumerator() | Sort-Object Value -Descending
If ($release_dates.ContainsKey("$($latest.LATEST_FIREFOX_VERSION)")) {
$latest_release_date = $release_dates.Get_Item("$($latest.LATEST_FIREFOX_VERSION)")
} Else {
$latest_release_date = "[unknown]"
} # Else
} Else {
$continue = $true
} # Else
$latest_firefox += $obj_latest = New-Object -TypeName PSCustomObject -Property @{
'Nightly' = $latest.FIREFOX_NIGHTLY
'Aurora' = $latest.FIREFOX_AURORA
'In Development' = $latest.LATEST_FIREFOX_DEVEL_VERSION
'Released Beta' = $latest.LATEST_FIREFOX_RELEASED_DEVEL_VERSION
'Extended-Support Release (ESR)' = $latest.FIREFOX_ESR
'Extended-Support Release (ESR) Next' = $latest.FIREFOX_ESR_NEXT
'Old' = $latest.LATEST_FIREFOX_OLDER_VERSION
'Latest Release Date' = $latest_release_date
'Major Versions' = $major_url
'Release History' = $history_url
'History' = "https://www.mozilla.org/en-US/firefox/releases/"
'Info' = [string]"https://www.mozilla.org/en-US/firefox/" + $latest.LATEST_FIREFOX_VERSION + "/releasenotes/"
'Current' = $latest.LATEST_FIREFOX_VERSION
} # New-Object
$latest_firefox.PSObject.TypeNames.Insert(0,"Latest Firefox Versions")
$most_recent_firefox_version = $latest_firefox | Select-Object -ExpandProperty Current
# Display the most recent and extended support Firefox version numbers in console
If ($latest_firefox -ne $null) {
$latest_firefox_selection = $latest_firefox | Select-Object 'Nightly','Aurora','In Development','Released Beta','Extended-Support Release (ESR)','Old','Latest Release Date','Release History','History','Info','Current'
$empty_line | Out-String
$header_firefox_enumeration = "Latest Firefox Versions"
$coline_firefox_enumeration = "-----------------------"
Write-Output $header_firefox_enumeration
$coline_firefox_enumeration | Out-String
Write-Output $latest_firefox_selection
} Else {
$continue = $true
} # Else
# Step 9
# Try to determine which Firefox versions, if any, are outdated and need to be updated.
$downloading_firefox_is_required = $false
$downloading_firefox_32_is_required = $false
$downloading_firefox_64_is_required = $false
If ($firefox_is_installed -eq $true) {
$most_recent_firefox_already_exists = Check-InstalledSoftware "Mozilla Firefox $($most_recent_firefox_version)*"
$most_recent_32_bit_firefox_already_exists = Check-InstalledSoftware "Mozilla Firefox $($most_recent_firefox_version) (x86*"
$most_recent_64_bit_firefox_already_exists = Check-InstalledSoftware "Mozilla Firefox $($most_recent_firefox_version) (x64*"
$all_32_bit_firefoxes = $firefox_enumeration | Where-Object { $_.Type -eq "32-bit" }
$number_of_32_bit_firefoxes = ($all_32_bit_firefoxes | Measure-Object).Count
$all_64_bit_firefoxes = $firefox_enumeration | Where-Object { $_.Type -eq "64-bit" }
$number_of_64_bit_firefoxes = ($all_64_bit_firefoxes | Measure-Object).Count
# 32-bit
If ($32_bit_firefox_is_installed -eq $false) {
$continue = $true
} ElseIf (($32_bit_firefox_is_installed -eq $true) -and ($most_recent_32_bit_firefox_already_exists) -and ($number_of_32_bit_firefoxes -eq 1)) {
# $downloading_firefox_32_is_required = $false
$locale = If (($most_recent_32_bit_firefox_already_exists.DisplayName.Split(" ")[-1] -match "\(") -eq $false) {
If ($powershell_v2_or_earlier -eq $true) {
$language.Get_Item(($most_recent_32_bit_firefox_already_exists.DisplayName.Split(" ")[-1]).Replace(")",""))
} Else {
$language | Select-Object -ExpandProperty (($most_recent_32_bit_firefox_already_exists.DisplayName.Split(" ")[-1]).Replace(")",""))
} # Else
} Else {
$continue = $true
} # Else ($locale)
If ($powershell_v2_or_earlier -eq $true) {
try
{
$release_date = $all_dates.Get_Item($most_recent_32_bit_firefox_already_exists.DisplayVersion)
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} Else {
try
{
$release_date = $all_dates | Select-Object -ExpandProperty $most_recent_32_bit_firefox_already_exists.DisplayVersion
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} # Else
$currently_installed_32 += New-Object -TypeName PSCustomObject -Property @{
'Name' = $most_recent_32_bit_firefox_already_exists.DisplayName.replace("(TM)","")
'Publisher' = $most_recent_32_bit_firefox_already_exists.Publisher
'Product' = $most_recent_32_bit_firefox_already_exists.DisplayName.Split(" ")[1]
'Type' = "32-bit"
'Locale' = $locale
'Computer' = $computer
'Install Location' = $most_recent_32_bit_firefox_already_exists.InstallLocation
'Release Notes' = $most_recent_32_bit_firefox_already_exists.URLUpdateInfo
'Standard Uninstall String' = $most_recent_32_bit_firefox_already_exists.UninstallString.Trim('"')
'Identifying Number' = $most_recent_32_bit_firefox_already_exists.PSChildName
'Release_Date' = $release_date
'Version' = $most_recent_32_bit_firefox_already_exists.DisplayVersion
} # New-Object
$currently_installed_32.PSObject.TypeNames.Insert(0,"Existing Current Firefox 32-bit")
$empty_line | Out-String
Write-Output "Currently (until the next Firefox version is released) the $($($currently_installed_32.Locale).English) 32-bit $($currently_installed_32.Name) released on $((Get-Date ($currently_installed_32.Release_Date)).ToShortDateString()) doesn't need any further maintenance or care."
} Else {
$downloading_firefox_32_is_required = $true
$downloading_firefox_is_required = $true
ForEach ($32_bit_firefox in $all_32_bit_firefoxes) {
If ($32_bit_firefox.Version -eq $most_recent_firefox_version) {
If ($powershell_v2_or_earlier -eq $true) {
try
{
$release_date = $all_dates.Get_Item($32_bit_firefox.Version)
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} Else {
try
{
$release_date_32 = $all_dates | Select-Object -ExpandProperty "$($32_bit_firefox.Version)"
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} # Else
$empty_line | Out-String
Write-Output "Currently (until the next Firefox version is released) the 32-bit $($32_bit_firefox.Name) released on $((Get-Date ($release_date_32)).ToShortDateString()) doesn't need any further maintenance or care."
} Else {
$empty_line | Out-String
Write-Warning "$($32_bit_firefox.Name) seems to be outdated."
$empty_line | Out-String
Write-Output "The most recent non-beta Firefox version is $most_recent_firefox_version. The installed 32-bit Firefox version $($32_bit_firefox.Version) needs to be updated."
} # Else
} # ForEach
} # Else
# 64-bit
If ($64_bit_firefox_is_installed -eq $false) {
$continue = $true
} ElseIf (($64_bit_firefox_is_installed -eq $true) -and ($most_recent_64_bit_firefox_already_exists) -and ($number_of_64_bit_firefoxes -eq 1)) {
# $downloading_firefox_64_is_required = $false
$locale = If (($most_recent_64_bit_firefox_already_exists.DisplayName.Split(" ")[-1] -match "\(") -eq $false) {
If ($powershell_v2_or_earlier -eq $true) {
$language.Get_Item(($most_recent_64_bit_firefox_already_exists.DisplayName.Split(" ")[-1]).Replace(")",""))
} Else {
$language | Select-Object -ExpandProperty (($most_recent_64_bit_firefox_already_exists.DisplayName.Split(" ")[-1]).Replace(")",""))
} # Else
} Else {
$continue = $true
} # Else ($locale)
If ($powershell_v2_or_earlier -eq $true) {
try
{
$release_date = $all_dates.Get_Item($most_recent_64_bit_firefox_already_exists.DisplayVersion)
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} Else {
try
{
$release_date = $all_dates | Select-Object -ExpandProperty $most_recent_64_bit_firefox_already_exists.DisplayVersion
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} # Else
$currently_installed_64 += New-Object -TypeName PSCustomObject -Property @{
'Name' = $most_recent_64_bit_firefox_already_exists.DisplayName.replace("(TM)","")
'Publisher' = $most_recent_64_bit_firefox_already_exists.Publisher
'Product' = $most_recent_64_bit_firefox_already_exists.DisplayName.Split(" ")[1]
'Type' = "64-bit"
'Locale' = $locale
'Computer' = $computer
'Install Location' = $most_recent_64_bit_firefox_already_exists.InstallLocation
'Release Notes' = $most_recent_64_bit_firefox_already_exists.URLUpdateInfo
'Standard Uninstall String' = $most_recent_64_bit_firefox_already_exists.UninstallString.Trim('"')
'Identifying Number' = $most_recent_64_bit_firefox_already_exists.PSChildName
'Release_Date' = $release_date
'Version' = $most_recent_64_bit_firefox_already_exists.DisplayVersion
} # New-Object
$currently_installed_64.PSObject.TypeNames.Insert(0,"Existing Current Firefox 64-bit")
$empty_line | Out-String
Write-Output "Currently (until the next Firefox version is released) the $($($currently_installed_64.Locale).English) 64-bit $($currently_installed_64.Name) released on $((Get-Date ($currently_installed_64.Release_Date)).ToShortDateString()) doesn't need any further maintenance or care."
} Else {
$downloading_firefox_64_is_required = $true
$downloading_firefox_is_required = $true
ForEach ($64_bit_firefox in $all_64_bit_firefoxes) {
If ($64_bit_firefox.Version -eq $most_recent_firefox_version) {
If ($powershell_v2_or_earlier -eq $true) {
try
{
$release_date_64 = $all_dates.Get_Item($64_bit_firefox.Version)
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} Else {
try
{
$release_date_64 = $all_dates | Select-Object -ExpandProperty "$($64_bit_firefox.Version)"
}
catch
{
$message = $error[0].Exception
Write-Verbose $message
}
} # Else
$empty_line | Out-String
Write-Output "Currently (until the next Firefox version is released) the 64-bit $($64_bit_firefox.Name) released on $((Get-Date ($release_date_64)).ToShortDateString()) doesn't need any further maintenance or care."
} Else {
$empty_line | Out-String
Write-Warning "$($64_bit_firefox.Name) seems to be outdated."
$empty_line | Out-String
Write-Output "The most recent non-beta Firefox version is $most_recent_firefox_version. The installed 64-bit Firefox version $($64_bit_firefox.Version) needs to be updated."
} # Else
} # ForEach
} # Else
} Else {
$continue = $true
} # Else
# Step 10
# Write the Maintenance info in console
If ($firefox_is_installed -eq $true) {
$32_bit_uninstall_string = $all_32_bit_firefoxes | Select-Object -ExpandProperty 'Standard Uninstall String'
$64_bit_uninstall_string = $all_64_bit_firefoxes | Select-Object -ExpandProperty 'Standard Uninstall String'
$obj_maintenance += New-Object -TypeName PSCustomObject -Property @{
'Open the Firefox primary profile location' = [string]'Invoke-Item ' + $quote + [Environment]::GetFolderPath("ApplicationData") + '\Mozilla\Firefox\Profiles' + $unquote
'Open the Firefox secondary profile location' = [string]'Invoke-Item ' + $quote + [Environment]::GetFolderPath("LocalApplicationData") + '\Mozilla\Firefox\Profiles' + $unquote
'Open the updates.xml file location' = [string]'Invoke-Item ' + $quote + [Environment]::GetFolderPath("LocalApplicationData") + '\Mozilla\updates\' + $unquote
'Uninstall the 32-bit Firefox' = If ($32_bit_firefox_is_installed -eq $true) { $32_bit_uninstall_string } Else { [string]'[not installed]' }
'Uninstall the 64-bit Firefox' = If ($64_bit_firefox_is_installed -eq $true) { $64_bit_uninstall_string } Else { [string]'[not installed]' }
} # New-Object
$obj_maintenance.PSObject.TypeNames.Insert(0,"Maintenance")
$obj_maintenance_selection = $obj_maintenance | Select-Object 'Open the Firefox primary profile location','Open the Firefox secondary profile location','Open the updates.xml file location','Uninstall the 32-bit Firefox','Uninstall the 64-bit Firefox'
# Display the Maintenance table in console
$empty_line | Out-String
$header_maintenance = "Maintenance"
$coline_maintenance = "-----------"
Write-Output $header_maintenance
$coline_maintenance | Out-String
Write-Output $obj_maintenance_selection
$obj_downloading += New-Object -TypeName PSCustomObject -Property @{
'32-bit Firefox' = If ($32_bit_firefox_is_installed -eq $true) { $downloading_firefox_32_is_required } Else { [string]'-' }
'64-bit Firefox' = If ($64_bit_firefox_is_installed -eq $true) { $downloading_firefox_64_is_required } Else { [string]'-' }
} # New-Object
$obj_downloading.PSObject.TypeNames.Insert(0,"Maintenance Is Required for These Firefox Versions")
$obj_downloading_selection = $obj_downloading | Select-Object '32-bit Firefox','64-bit Firefox'
# Display in console which installers for Firefox need to be downloaded
$empty_line | Out-String
$header_downloading = "Maintenance Is Required for These Firefox Versions"
$coline_downloading = "--------------------------------------------------"
Write-Output $header_downloading
$coline_downloading | Out-String
Write-Output $obj_downloading_selection
$empty_line | Out-String
} Else {
$continue = $true
} # Else
# Step 11
# Determine if there is a real need to carry on with the rest of the script.
If ($firefox_is_installed -eq $true) {
If (($downloading_firefox_is_required -eq $false) -and ($downloading_firefox_32_is_required -eq $false) -and ($downloading_firefox_64_is_required -eq $false)) {
Return "The installed Firefox seems to be OK."
} Else {
$continue = $true
} # Else
} Else {
Write-Warning "No Firefox seems to be installed on the system."
$empty_line | Out-String
$no_firefox_text_1 = "This script didn't detect that any version of Firefox would have been installed."
$no_firefox_text_2 = "Please consider installing Firefox by visiting"
$no_firefox_text_3 = "https://www.mozilla.org/en-US/firefox/all/"
$no_firefox_text_4 = "For URLs of the full installation files please, for example, see the page"
$no_firefox_text_5 = "https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt"
$no_firefox_text_6 = "and for uninstalling Firefox, please visit"
$no_firefox_text_7 = "https://support.mozilla.org/en-US/kb/uninstall-firefox-from-your-computer"
Write-Output $no_firefox_text_1
Write-Output $no_firefox_text_2
Write-Output $no_firefox_text_3
Write-Output $no_firefox_text_4
Write-Output $no_firefox_text_5
Write-Output $no_firefox_text_6
Write-Output $no_firefox_text_7
# Offer the option to install a specific version of Firefox, if no Firefox is detected and the script is run in an elevated window
# Source: "Adding a Simple Menu to a Windows PowerShell Script": https://technet.microsoft.com/en-us/library/ff730939.aspx
# Credit: lamaar75: "Creating a Menu": http://powershell.com/cs/forums/t/9685.aspx
# Credit: alejandro5042: "How to run exe with/without elevated privileges from PowerShell"
If (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator") -eq $true) {
$empty_line | Out-String
Write-Verbose "Welcome to the Admin Corner." -verbose
$title_1 = "Install Firefox - The Fundamentals (Step 1/3)"
$message_1 = "Would you like to install one of the Firefox versions (32-bit or 64-bit in a certain language) with this script?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes: tries to download and install one of the Firefox versions specified on the next two steps."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No: exits from this script (similar to Ctrl + C)."
$exit = New-Object System.Management.Automation.Host.ChoiceDescription "&Exit", "Exit: exits from this script (similar to Ctrl + C)."
$abort = New-Object System.Management.Automation.Host.ChoiceDescription "&Abort", "Abort: exits from this script (similar to Ctrl + C)."
$cancel = New-Object System.Management.Automation.Host.ChoiceDescription "&Cancel", "Cancel: exits from this script (similar to Ctrl + C)."
$options_1 = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $exit, $abort, $cancel)
$result_1 = $host.ui.PromptForChoice($title_1, $message_1, $options_1, 1)
switch ($result_1)
{
0 {
"Yes. Proceeding to the next step.";
$admin_corner = $true
$continue = $true
}
1 {
"No. Exiting from Install Firefox script.";
Exit
}
2 {
"Exit. Exiting from Install Firefox script.";
Exit
}
3 {
"Abort. Exiting from Install Firefox script.";
Exit
}
4 {
"Cancel. Exiting from Install Firefox script.";
Exit
} # 4
} # switch
$empty_line | Out-String
$title_2 = "Install Firefox - The Bit Version (Step 2/3)"
$message_2 = "Which bit version (32-bit or 64-bit) of Firefox would you like to install?"
$32_bit = New-Object System.Management.Automation.Host.ChoiceDescription "&32-bit", "32-bit: tries to download and install the 32-bit version of Firefox."
$64_bit = New-Object System.Management.Automation.Host.ChoiceDescription "&64-bit", "64-bit: tries to download and install the 64-bit version of Firefox."
$options_2 = [System.Management.Automation.Host.ChoiceDescription[]]($32_bit, $64_bit, $exit, $abort, $cancel)
$result_2 = $host.ui.PromptForChoice($title_2, $message_2, $options_2, 4)
switch ($result_2)
{
0 {
"32-bit selected.";
$firefox_is_installed = $true
$32_bit_firefox_is_installed = $true
$original_firefox_version = "[Nonexistent]"
$downloading_firefox_is_required = $true
$downloading_firefox_32_is_required = $true
$os = '&os=win'
$bit_number = "32"
$continue = $true
}
1 {
"64-bit selected.";
$firefox_is_installed = $true
$64_bit_firefox_is_installed = $true
$original_firefox_version = "[Nonexistent]"
$downloading_firefox_is_required = $true
$downloading_firefox_64_is_required = $true
$os = '&os=win64'
$bit_number = "64"
$continue = $true
}
2 {
"Exit. Exiting from Install Firefox script.";
Exit
}
3 {
"Abort. Exiting from Install Firefox script.";
Exit
}
4 {
"Cancel. Exiting from Install Firefox script.";
Exit
} # 4
} # switch
$empty_line | Out-String
$title_3 = "Install Firefox - The Language (Step 3/3)"
$message_3 = "Which language version of Firefox would you like to install?"
$0 = New-Object System.Management.Automation.Host.ChoiceDescription "&0 English (US)", "English (US): tries to download and install the English (US) version of Firefox."
$1 = New-Object System.Management.Automation.Host.ChoiceDescription "&1 English (British)", "English (British): tries to download and install the English (British) version of Firefox."
$2 = New-Object System.Management.Automation.Host.ChoiceDescription "&2 Arabic", "Arabic: tries to download and install the Arabic version of Firefox."
$3 = New-Object System.Management.Automation.Host.ChoiceDescription "&3 Chinese (Simplified)", "Chinese (Simplified): tries to download and install the Chinese (Simplified) version of Firefox."
$4 = New-Object System.Management.Automation.Host.ChoiceDescription "&4 Chinese (Traditional)", "Chinese (Traditional): tries to download and install the Chinese (Traditional) version of Firefox."
$5 = New-Object System.Management.Automation.Host.ChoiceDescription "&5 Dutch", "Dutch: tries to download and install the Dutch version of Firefox."
$6 = New-Object System.Management.Automation.Host.ChoiceDescription "&6 French", "French: tries to download and install the French version of Firefox."
$7 = New-Object System.Management.Automation.Host.ChoiceDescription "&7 German", "German: tries to download and install the German version of Firefox."
$8 = New-Object System.Management.Automation.Host.ChoiceDescription "&8 Portuguese (Portugal)", "Portuguese (Portugal): tries to download and install the Portuguese (Portugal) version of Firefox."
$9 = New-Object System.Management.Automation.Host.ChoiceDescription "&9 Spanish (Spain)", "Spanish (Spain): tries to download and install the Spanish (Spain) version of Firefox."
$b = New-Object System.Management.Automation.Host.ChoiceDescription "&b Bengali (India)", "Bengali (India): tries to download and install the Bengali (India) version of Firefox."
$d = New-Object System.Management.Automation.Host.ChoiceDescription "&d Danish", "Danish: tries to download and install the Danish version of Firefox."
$f = New-Object System.Management.Automation.Host.ChoiceDescription "&f Finnish", "Finnish: tries to download and install the Finnish version of Firefox."
$g = New-Object System.Management.Automation.Host.ChoiceDescription "&g Greek", "Greek: tries to download and install the Greek version of Firefox."
$h = New-Object System.Management.Automation.Host.ChoiceDescription "&h Hebrew", "Hebrew: tries to download and install the Hebrew version of Firefox."
$i = New-Object System.Management.Automation.Host.ChoiceDescription "&i Italian", "Italian: tries to download and install the Italian version of Firefox."
$j = New-Object System.Management.Automation.Host.ChoiceDescription "&j Indonesian", "Indonesian: tries to download and install the Indonesian version of Firefox."
$k = New-Object System.Management.Automation.Host.ChoiceDescription "&k Korean", "Korean: tries to download and install the Korean version of Firefox."
$l = New-Object System.Management.Automation.Host.ChoiceDescription "&l Latvian", "Latvian: tries to download and install the Latvian version of Firefox."
$m = New-Object System.Management.Automation.Host.ChoiceDescription "&m Malay", "Malay: tries to download and install the Malay version of Firefox."
$n = New-Object System.Management.Automation.Host.ChoiceDescription "&n Norwegian (Nynorsk)", "Norwegian (Nynorsk): tries to download and install the Norwegian (Nynorsk) version of Firefox."
$o = New-Object System.Management.Automation.Host.ChoiceDescription "&o Norwegian (Bokmal)", "Norwegian (Bokmal): tries to download and install the Norwegian (Bokmal) version of Firefox."
$p = New-Object System.Management.Automation.Host.ChoiceDescription "&p Punjabi (India)", "Punjabi (India): tries to download and install the Punjabi (India) version of Firefox."
$q = New-Object System.Management.Automation.Host.ChoiceDescription "&q Hindi (India)", "Hindi (India): tries to download and install the Hindi (India) version of Firefox."
$r = New-Object System.Management.Automation.Host.ChoiceDescription "&r Romanian", "Romanian: tries to download and install the Romanian version of Firefox."
$s = New-Object System.Management.Automation.Host.ChoiceDescription "&s Swedish", "Swedish: tries to download and install the Swedish version of Firefox."
$t = New-Object System.Management.Automation.Host.ChoiceDescription "&t Thai", "Thai: tries to download and install the Thai version of Firefox."
$u = New-Object System.Management.Automation.Host.ChoiceDescription "&u Ukrainian", "Ukrainian: tries to download and install the Ukrainian version of Firefox."
$v = New-Object System.Management.Automation.Host.ChoiceDescription "&v Vietnamese", "Vietnamese: tries to download and install the Vietnamese version of Firefox."
$w = New-Object System.Management.Automation.Host.ChoiceDescription "&w Welsh", "Welsh: tries to download and install the Welsh version of Firefox."
$x = New-Object System.Management.Automation.Host.ChoiceDescription "&x Xhosa", "Xhosa: tries to download and install the Xhosa version of Firefox."
$y = New-Object System.Management.Automation.Host.ChoiceDescription "&y Gaelic (Scotland)", "Gaelic (Scotland): tries to download and install the Gaelic (Scotland) version of Firefox."
$z = New-Object System.Management.Automation.Host.ChoiceDescription "&z Uzbek", "Uzbek: tries to download and install the Uzbek version of Firefox."
$options_3 = [System.Management.Automation.Host.ChoiceDescription[]]($0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $b, $d, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, $s, $t, $u, $v, $w, $x, $y, $z, $exit, $abort, $cancel)
$result_3 = $host.ui.PromptForChoice($title_3, $message_3, $options_3, 35)
switch ($result_3)
{
0 {
"English (US) selected.";
$lang = '&lang=en-US'
$continue = $true
}
1 {
"English (British) selected.";
$lang = '&lang=en-GB'
$continue = $true
}
2 {
"Arabic selected.";
$lang = '&lang=ar'
$continue = $true
}
3 {
"Chinese (Simplified) selected.";
$lang = '&lang=zh-CN'
$continue = $true
}
4 {
"Chinese (Traditional) selected.";
$lang = '&lang=zh-TW'
$continue = $true
}
5 {
"Dutch selected.";
$lang = '&lang=nl'
$continue = $true
}
6 {
"French selected.";
$lang = '&lang=fr'
$continue = $true
}
7 {
"German selected.";
$lang = '&lang=de'
$continue = $true
}
8 {
"Portuguese (Portugal) selected.";
$lang = '&lang=pt-PT'
$continue = $true
}
9 {
"Spanish (Spain) selected.";
$lang = '&lang=es-ES'
$continue = $true
}
10 {
"Bengali (India) selected.";
$lang = '&lang=bn-IN'
$continue = $true