-
Notifications
You must be signed in to change notification settings - Fork 1
/
Update-AdobeFlashPlayer.ps1
1960 lines (1497 loc) · 103 KB
/
Update-AdobeFlashPlayer.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-AdobeFlashPlayer.ps1
Requires a working Internet connection for downloading a list of the most recent
Flash version numbers.
Also requires a working Internet connection for downloading a Flash uninstaller and a
complete Flash installer(s) from Adobe (but this procedure is not initiated, if the
system is deemed up-to-date).
During the optional update phase requires to be run in an elevated PowerShell window
(where PowerShell has been started with the 'run as an administrator' option). The
elevated rights are needed for uninstalling Flash, installing Flash and for writing
the mms.cfg file.
Please also notice that during the actual update phase Update-AdobeFlashPlayer
closes a bunch of processes without any further notice in Step 3 and in Step 6
Update-AdobeFlashPlayer alters the Flash configuration file (mms.cfg) so, that for
instance, the automatic Flash updates are turned off.
If a working Internet connection is not found, Update-AdobeFlashPlayer will exit at
an early stage without displaying any info apart from what is found on the system. If
Update-AdobeFlashPlayer is run without elevated rights (but with a working Internet
connection), it will be shown, whether a Flash update is needed or not, but the script
will exit before actually downloading any files or making any changes to the system.
The Flash Player ActiveX control on Windows 8.1 and above is a component of Internet
Explorer and Edge and is updated via Windows Update. By using the Flash Player
ActiveX installer, Flash Player ActiveX control cannot be installed on Windows 8.1
and above systems. Also, the Flash Player uninstaller doesn't uninstall the ActiveX
control on Windows 8.1 and above systems.
For further info, for instance a command
help ./Update-AdobeFlashPlayer -Full
may be used at the PowerShell prompt window [PS>] in the folder, where the script is placed.
https://forums.adobe.com/thread/2208103
Alternatively, if you just want a notification when security updates become available
(and with a continuous, sustained investment in security hardening, that's pretty much every release),
you can subscribe to the Adobe Security Notification Service,
which sends out email alerts when security updates become available for our products.
https://forums.adobe.com/thread/2208103
Adobe Security Notification E-Mail Service Subscription Page:
https://campaign.adobe.com/webApp/adbeSecurityNotificationsRegistration?id=0
Adobe Flash Player Master Version XML file:
http://fpdownload.macromedia.com/pub/flashplayer/masterversion/masterversion.xml
Adobe Flash Player Administration Guide:
https://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html
#>
$path = $env:temp
$computer = $env:COMPUTERNAME
$ErrorActionPreference = "Stop"
$start_time = Get-Date
$empty_line = ""
# 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
# Function to check whether a program is installed or not # Credit: chocolatey: "Flash Player Plugin"
Function Check-InstalledSoftware ($display_name, $display_version) {
Return Get-ItemProperty $registry_paths -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -eq $display_name -and $_.DisplayVersion -eq $display_version }
} # function
# Try to find out which Flash versions, if any, are installed on the system
# Source: "Adobe Flash Player Administration Guide": http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html
<#
### .msi installed ActiveX for IE
### Note: Get-WmiObject -Class Win32_Product is very slow to run...
$activex_already_installed = $false
$activex_major_version = ([version]$xml_activex_win_current).Major
If (Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq "Adobe Flash Player $activex_major_version ActiveX" -and $_.Version -eq $xml_activex_win_current }) {
$activex_already_installed = $true
$activex_already_text = "The most recent version of Adobe Flash Player ActiveX for IE $activex_version is already installed."
Write-Output $activex_already_text
} Else {
$continue = $true
} # else
#>
# .exe or .msi installed ActiveX for IE
# The player is an OCX file whose name reflects the version number.
$activex_is_installed = $false
If ((Test-Path $env:windir\System32\Macromed\Flash\Flash32*.ocx) -eq $true) {
# For example, Flash32_11_2_202_228.ocx (32-bit Windows)
$activex_is_installed = $true
$activex_32_bit_file = Get-ChildItem $env:windir\System32\Macromed\Flash\Flash32*.ocx -ErrorAction Stop
$activex_32_bit_version = ((Get-Item $activex_32_bit_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} If ((Test-Path $env:windir\System32\Macromed\Flash\Flash64*.ocx) -eq $true) {
# For example, Flash64_11_2_202_228.ocx (64-bit Windows)
$activex_is_installed = $true
$activex_64_bit_file = Get-ChildItem $env:windir\System32\Macromed\Flash\Flash64*.ocx -ErrorAction Stop
$activex_64_bit_version = ((Get-Item $activex_64_bit_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} If ((Test-Path $env:windir\SysWow64\Macromed\Flash\Flash*.ocx) -eq $true) {
# For example, Flash32_11_2_202_228.ocx (32-bit Windows)
$activex_is_installed = $true
$activex_64_bit_in_32_bit_mode_file = Get-ChildItem $env:windir\SysWow64\Macromed\Flash\Flash*.ocx -ErrorAction Stop
$activex_64_bit_in_32_bit_mode_version = ((Get-Item $activex_64_bit_in_32_bit_mode_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} Else {
$continue = $true
} # else
# .msi installed Firefox Plugin (NPAPI)
# .exe or .msi installed Firefox Plugin (NPAPI)
# On Windows, files named NPSWF32.dll (NPSWF64.dll for 64-bit Windows) and flashplayer.xpt are installed, and for Flash Player 11.2 and later, the dll file name also includes the build number.
$plugin_is_installed = $false
If ((Test-Path $env:windir\System32\Macromed\Flash\NPSWF32*.dll) -eq $true) {
# For example, NPSWF32_11_2_202_228.dll (32-bit Windows)
$plugin_is_installed = $true
$plugin_32_bit_file = Get-ChildItem $env:windir\System32\Macromed\Flash\NPSWF32*.dll -ErrorAction Stop
$plugin_32_bit_version = ((Get-Item $plugin_32_bit_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} If ((Test-Path $env:windir\System32\Macromed\Flash\NPSWF64*.dll) -eq $true) {
# For example, NPSWF64_11_2_202_228.dll (64-bit Windows)
$plugin_is_installed = $true
$plugin_64_bit_file = Get-ChildItem $env:windir\System32\Macromed\Flash\NPSWF64*.dll -ErrorAction Stop
$plugin_64_bit_version = ((Get-Item $plugin_64_bit_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} If ((Test-Path $env:windir\SysWow64\Macromed\Flash\NPSWF*.dll) -eq $true) {
# For example, NPSWF32_11_2_202_228.dll (32-bit Windows)
$plugin_is_installed = $true
$plugin_64_bit_in_32_bit_mode_file = Get-ChildItem $env:windir\SysWow64\Macromed\Flash\NPSWF*.dll -ErrorAction Stop
$plugin_64_bit_in_32_bit_mode_version = ((Get-Item $plugin_64_bit_in_32_bit_mode_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} Else {
$continue = $true
} # else
# .msi installed pepper Opera and Chromium-based browsers (PPAPI)
# .exe or .msi installed pepper Opera and Chromium-based browsers (PPAPI)
# On Windows, files named pepflashplayer32.dll (pepflashplayer64.dll for 64-bit Windows) and manifest.json are installed. The dll file name also includes the build number.
$pepper_is_installed = $false
If ((Test-Path $env:windir\System32\Macromed\Flash\pepflashplayer32*.dll) -eq $true) {
# For example, pepflashplayer32_22_0_0_157.dll (32-bit Windows)
$pepper_is_installed = $true
$pepper_32_bit_file = Get-ChildItem $env:windir\System32\Macromed\Flash\pepflashplayer32*.dll -ErrorAction Stop
$pepper_32_bit_version = ((Get-Item $pepper_32_bit_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} If ((Test-Path $env:windir\System32\Macromed\Flash\pepflashplayer64*.dll) -eq $true) {
# For example, pepflashplayer64_22_0_0_157.dll (64-bit Windows)
$pepper_is_installed = $true
$pepper_64_bit_file = Get-ChildItem $env:windir\System32\Macromed\Flash\pepflashplayer64*.dll -ErrorAction Stop
$pepper_64_bit_version = ((Get-Item $pepper_64_bit_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} If ((Test-Path $env:windir\SysWow64\Macromed\Flash\pepflashplayer*.dll) -eq $true) {
# For example, pepflashplayer32_22_0_0_157.dll (32-bit Windows)
$pepper_is_installed = $true
$pepper_64_bit_in_32_bit_mode_file = Get-ChildItem $env:windir\SysWow64\Macromed\Flash\pepflashplayer*.dll -ErrorAction Stop
$pepper_64_bit_in_32_bit_mode_version = ((Get-Item $pepper_64_bit_in_32_bit_mode_file | Select-Object -ExpandProperty VersionInfo).ProductVersion).replace(",",".")
} Else {
$continue = $true
} # else
$obj_existing += New-Object -TypeName PSCustomObject -Property @{
'Windows Internet Explorer (ActiveX) Flash Player is installed?' = $activex_is_installed
'Windows Firefox (NPAPI) Flash Player is installed?' = $plugin_is_installed
'Windows Opera and Chromium-based browsers (PPAPI) Flash Player is installed?' = $pepper_is_installed
'Internet Explorer (ActiveX) Flash Player (32-bit)' = $activex_32_bit_version
'Internet Explorer (ActiveX) Flash Player (64-bit)' = $activex_64_bit_version
'Internet Explorer (ActiveX) Flash Player (64-bit in 32-bit mode)' = $activex_64_bit_in_32_bit_mode_version
'Firefox (NPAPI) Flash Player (32-bit)' = $plugin_32_bit_version
'Firefox (NPAPI) Flash Player (64-bit)' = $plugin_64_bit_version
'Firefox (NPAPI) Flash Player (64-bit in 32-bit mode)' = $plugin_64_bit_in_32_bit_mode_version
'Opera and Chromium-based browsers (PPAPI) Flash Player (32-bit)' = $pepper_32_bit_version
'Opera and Chromium-based browsers (PPAPI) Flash Player (64-bit)' = $pepper_64_bit_version
'Opera and Chromium-based browsers (PPAPI) Flash Player (64-bit in 32-bit mode)' = $pepper_64_bit_in_32_bit_mode_version
} # New-Object
$obj_existing.PSObject.TypeNames.Insert(0,"Previously Installed (Existing) Flash Player Versions Found on the System")
$obj_existing_selection = $obj_existing | Select-Object 'Windows Internet Explorer (ActiveX) Flash Player is installed?','Windows Firefox (NPAPI) Flash Player is installed?','Windows Opera and Chromium-based browsers (PPAPI) Flash Player is installed?','Internet Explorer (ActiveX) Flash Player (32-bit)','Internet Explorer (ActiveX) Flash Player (64-bit)','Internet Explorer (ActiveX) Flash Player (64-bit in 32-bit mode)','Firefox (NPAPI) Flash Player (32-bit)','Firefox (NPAPI) Flash Player (64-bit)','Firefox (NPAPI) Flash Player (64-bit in 32-bit mode)','Opera and Chromium-based browsers (PPAPI) Flash Player (32-bit)','Opera and Chromium-based browsers (PPAPI) Flash Player (64-bit)','Opera and Chromium-based browsers (PPAPI) Flash Player (64-bit in 32-bit mode)'
# Display the previously installed (existing) Flash version numbers in console
$header_existing = "Previously Installed (Existing) Flash Player Versions Found on the System"
$coline_existing = "-------------------------------------------------------------------------"
Write-Output $header_existing
$coline_existing | Out-String
Write-Output $obj_existing_selection
$empty_line | Out-String
# Determine the original installed Flash version numbers regardles whether the system is 32- or 64-bits.
If ($activex_64_bit_in_32_bit_mode_version -ne $null) { $activex_baseline = $activex_64_bit_in_32_bit_mode_version } Else { $continue = $true }
If ($activex_32_bit_version -ne $null) { $activex_baseline = $activex_32_bit_version } Else { $continue = $true }
If ($activex_64_bit_version -ne $null) { $activex_baseline = $activex_64_bit_version } Else { $continue = $true }
If ($plugin_64_bit_in_32_bit_mode_version -ne $null) { $plugin_baseline = $plugin_64_bit_in_32_bit_mode_version } Else { $continue = $true }
If ($plugin_32_bit_version -ne $null) { $plugin_baseline = $plugin_32_bit_version } Else { $continue = $true }
If ($plugin_64_bit_version -ne $null) { $plugin_baseline = $plugin_64_bit_version } Else { $continue = $true }
If ($pepper_64_bit_in_32_bit_mode_version -ne $null) { $pepper_baseline = $pepper_64_bit_in_32_bit_mode_version } Else { $continue = $true }
If ($pepper_32_bit_version -ne $null) { $pepper_baseline = $pepper_32_bit_version } Else { $continue = $true }
If ($pepper_64_bit_version -ne $null) { $pepper_baseline = $pepper_64_bit_version } Else { $continue = $true }
# 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 Flash version numbers or without updating Flash."
} Else {
Write-Verbose 'Checking the most recent Flash version numbers from the Flash website...'
} # else
# Check the most recent Flash version numbers by connecting to the Flash website
# Source: "Adobe Flash Player Administration Guide": http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html
$xml_url = "https://fpdownload.macromedia.com/pub/flashplayer/masterversion/masterversion.xml"
try
{
$xml_versions = New-Object XML
$xml_versions.Load($xml_url)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $xml_url"
$empty_line | Out-String
$xml_text = "Please consider running this script again. Sometimes the XML-file just isn't queryable for no apparent reason. The success rate 'in the second go' usually seems to be a bit higher."
Write-Output $xml_text
$empty_line | Out-String
Return "Exiting without checking the latest Flash version numbers or without updating Flash."
}
$xml_activex_win8_current = ($xml_versions.version.release.ActiveX_win8.version).replace(",",".")
$xml_activex_win10_current = ($xml_versions.version.release.ActiveX_win10.version).replace(",",".")
$xml_activex_edge_current = ($xml_versions.version.release.ActiveX_Edge.version).replace(",",".")
$xml_activex_win_current = ($xml_versions.version.release.ActiveX_win.version).replace(",",".")
$xml_plugin_win_current = ($xml_versions.version.release.NPAPI_win.version).replace(",",".")
$xml_plugin_mac_current = ($xml_versions.version.release.NPAPI_mac.version).replace(",",".")
$xml_plugin_linux_current = ($xml_versions.version.release.NPAPI_linux.version).replace(",",".")
$xml_ppapi_win_current = ($xml_versions.version.release.PPAPI_win.version).replace(",",".")
$xml_ppapi_winchrome_current = ($xml_versions.version.release.PPAPI_winchrome.version).replace(",",".")
$xml_ppapi_mac_current = ($xml_versions.version.release.PPAPI_mac.version).replace(",",".")
$xml_ppapi_macchrome_current = ($xml_versions.version.release.PPAPI_macchrome.version).replace(",",".")
$xml_ppapi_linux_current = ($xml_versions.version.release.PPAPI_linux.version).replace(",",".")
$xml_ppapi_linuxchrome_current = ($xml_versions.version.release.PPAPI_linuxchrome.version).replace(",",".")
$xml_ppapi_chromeos_current = ($xml_versions.version.release.PPAPI_chromeos.version).replace(",",".")
# $xml_activex_win_extended = ($xml_versions.version.esr.ActiveX_win.version).replace(",",".")
# $xml_plugin_win_extended = ($xml_versions.version.esr.NPAPI_win.version).replace(",",".")
# $xml_plugin_mac_extended = ($xml_versions.version.esr.NPAPI_mac.version).replace(",",".")
$obj_most_recent += New-Object -TypeName PSCustomObject -Property @{
'Windows Internet Explorer (ActiveX)' = $xml_activex_win_current
'Windows Internet Explorer, embedded Windows 8.1 (ActiveX)' = [string]$xml_activex_win8_current + ' (updateable via Windows Update)'
'Windows Edge, embedded Windows 10 (ActiveX)' = [string]$xml_activex_edge_current + ' (updateable via Windows Update)'
'Windows Firefox (NPAPI)' = $xml_plugin_win_current
'Windows Chrome, embedded (PPAPI)' = $xml_ppapi_winchrome_current
'Windows Opera and Chromium-based browsers (PPAPI)' = $xml_ppapi_win_current
'Macintosh OS X Firefox and Safari (NPAPI)' = $xml_plugin_mac_current
'Macintosh OS X Chrome, embedded (PPAPI)' = $xml_ppapi_macchrome_current
'Macintosh OS X Opera and Chromium-based browsers (PPAPI)' = $xml_ppapi_mac_current
'Linux Chrome, embedded (PPAPI)' = $xml_ppapi_linuxchrome_current
'Linux Chromium-based browsers (PPAPI)' = $xml_ppapi_linux_current
'ChromeOS (PPAPI)' = $xml_ppapi_chromeos_current
} # New-Object
$obj_most_recent.PSObject.TypeNames.Insert(0,"Most Recent non-beta Flash Player Versions Available")
$obj_most_recent_selection = $obj_most_recent | Select-Object 'Windows Internet Explorer (ActiveX)','Windows Internet Explorer, embedded Windows 8.1 (ActiveX)','Windows Edge, embedded Windows 10 (ActiveX)','Windows Firefox (NPAPI)','Windows Chrome, embedded (PPAPI)','Windows Opera and Chromium-based browsers (PPAPI)','Macintosh OS X Firefox and Safari (NPAPI)','Macintosh OS X Chrome, embedded (PPAPI)','Macintosh OS X Opera and Chromium-based browsers (PPAPI)','Linux Chrome, embedded (PPAPI)','Linux Chromium-based browsers (PPAPI)','ChromeOS (PPAPI)'
$obj_extended_support += New-Object -TypeName PSCustomObject -Property @{
'Extended Support Release Windows Internet Explorer (ActiveX) Flash version' = $xml_activex_win_extended
'Extended Support Release Windows Firefox (NPAPI) Flash version' = $xml_plugin_win_extended
'Extended Support Release Macintosh OS X Firefox and Safari (NPAPI) Flash version' = $xml_plugin_mac_extended
'Extended Support Release Linux Firefox (NPAPI) Flash version' = $xml_plugin_linux_current
} # New-Object
$obj_extended_support.PSObject.TypeNames.Insert(0,"Extended Support Release Flash Player Versions")
$obj_extended_support_selection = $obj_extended_support | Select-Object 'Extended Support Release Windows Internet Explorer (ActiveX) Flash version','Extended Support Release Windows Firefox (NPAPI) Flash version','Extended Support Release Macintosh OS X Firefox and Safari (NPAPI) Flash version','Extended Support Release Linux Firefox (NPAPI) Flash version'
# Display the most recent and extended support Flash version numbers in console
$header_most_recent = "Most Recent non-beta Flash Player Versions Available"
$coline_most_recent = "----------------------------------------------------"
Write-Output $header_most_recent
$coline_most_recent | Out-String
Write-Output $obj_most_recent_selection
$empty_line | Out-String
$header_extended = "Extended Support Release Flash Player Versions"
$coline_extended = "----------------------------------------------"
Write-Output $header_extended
$coline_extended | Out-String
$obj_extended_support_selection
$empty_line | Out-String
# Try to determine which Flash versions, if any, are outdated and need to be updated.
$most_recent_activex_major_version = ([version]$xml_activex_win_current).Major
$most_recent_plugin_major_version = ([version]$xml_plugin_win_current).Major
$most_recent_pepper_major_version = ([version]$xml_ppapi_win_current).Major
$downloading_activex_is_required = $false
$activex_exception = $false
If ($activex_is_installed -eq $true) {
$most_recent_activex_already_exists = Check-InstalledSoftware "Adobe Flash Player $most_recent_activex_major_version ActiveX" $xml_activex_win_current
If ([System.Environment]::OSVersion.Version -lt '6.2') {
If ($most_recent_activex_already_exists) {
Write-Output "Currently (until the next Flash Player version is released) Adobe Flash Player for Internet Explorer (ActiveX) v$activex_baseline doesn't need any further maintenance or care."
$empty_line | Out-String
} Else {
$downloading_activex_is_required = $true
Write-Warning "Adobe Flash Player for Internet Explorer (ActiveX) v$activex_baseline seems to be outdated."
$empty_line | Out-String
Write-Output "The most recent non-beta Flash version of ActiveX is v$xml_activex_win_current. The installed ActiveX Flash version v$activex_baseline needs to be updated."
$empty_line | Out-String
} # else
} ElseIf ([System.Environment]::OSVersion.Version -ge '6.2') {
If ($xml_activex_win_current -eq $activex_baseline) {
Write-Output "Currently (until the next Flash Player version is released) the ActiveX Adobe Flash Player for Internet Explorer and/or for Edge v$activex_baseline doesn't need any further maintenance or care."
$empty_line | Out-String
} Else {
$downloading_activex_is_required = $false
$activex_exception = $true
Write-Warning "Please use Windows Update to update Adobe Flash Player(s) for Internet Explorer (ActiveX) and/or for Edge (ActiveX)."
$empty_line | Out-String
Write-Output "Adobe Flash Player for Internet Explorer (ActiveX) v$activex_baseline seems to be outdated. The most recent non-beta Flash version of ActiveX is v$xml_activex_win_current. The installed ActiveX Flash version v$activex_baseline needs to be updated. However, the Flash Player ActiveX control on Windows 8.1 and above is a component of Internet Explorer and Edge and is updated via Windows Update. By using the standalone Flash Player ActiveX installer, Flash Player ActiveX control cannot be installed on Windows 8.1 and above systems. Also, the Flash Player uninstaller doesn't uninstall the ActiveX control on Windows 8.1 and above systems. For updating the ActiveX Flash Player on Windows 8.1 and above systems, please use the Windows Update."
$empty_line | Out-String
} # else
} Else {
$continue = $true
} # else
} Else {
$continue = $true
} # else
$downloading_plugin_is_required = $false
If ($plugin_is_installed -eq $true) {
$most_recent_plugin_already_exists = Check-InstalledSoftware "Adobe Flash Player $most_recent_plugin_major_version NPAPI" $xml_plugin_win_current
If ($most_recent_plugin_already_exists) {
Write-Output "Currently (until the next Flash Player version is released) Adobe Flash Player for Firefox (NPAPI) v$plugin_baseline doesn't need any further maintenance or care."
$empty_line | Out-String
} Else {
$downloading_plugin_is_required = $true
Write-Warning "Adobe Flash Player for Firefox (NPAPI) v$plugin_baseline seems to be outdated."
$empty_line | Out-String
Write-Output "The most recent non-beta Flash version of NPAPI is v$xml_plugin_win_current. The installed NPAPI Flash version v$plugin_baseline needs to be updated."
$empty_line | Out-String
} # else
} Else {
$continue = $true
} # else
$downloading_pepper_is_required = $false
If ($pepper_is_installed -eq $true) {
$most_recent_pepper_already_exists = Check-InstalledSoftware "Adobe Flash Player $most_recent_pepper_major_version PPAPI" $xml_ppapi_win_current
If ($most_recent_pepper_already_exists) {
Write-Output "Currently (until the next Flash Player version is released) Adobe Flash Player for Opera and Chromium-based browsers (PPAPI) v$pepper_baseline doesn't need any further maintenance or care."
$empty_line | Out-String
} Else {
$downloading_pepper_is_required = $true
Write-Warning "Adobe Flash Player for Opera and Chromium-based browsers (PPAPI) v$pepper_baseline seems to be outdated."
$empty_line | Out-String
Write-Output "The most recent non-beta Flash version of PPAPI is v$xml_ppapi_win_current. The installed PPAPI Flash version v$pepper_baseline needs to be updated."
$empty_line | Out-String
} # else
} Else {
$continue = $true
} # else
$obj_downloading += New-Object -TypeName PSCustomObject -Property @{
'Adobe Flash Player for Internet Explorer (ActiveX)' = If ($activex_exception -eq $true) { "True: Please use Windows Update to update Flash" } ElseIf ($activex_is_installed -eq $true) { $downloading_activex_is_required } Else { "-" }
'Adobe Flash Player for Firefox (NPAPI)' = If ($plugin_is_installed -eq $true) { $downloading_plugin_is_required } Else { "-" }
'Adobe Flash Player for Opera and Chromium-based browsers (PPAPI)' = If ($pepper_is_installed -eq $true) { $downloading_pepper_is_required } Else { "-" }
} # New-Object
$obj_downloading.PSObject.TypeNames.Insert(0,"Maintenance Is Required for These Flash Versions")
$obj_downloading_selection = $obj_downloading | Select-Object 'Adobe Flash Player for Internet Explorer (ActiveX)','Adobe Flash Player for Firefox (NPAPI)','Adobe Flash Player for Opera and Chromium-based browsers (PPAPI)'
# Display in console which installers for Flash Player need to be downloaded
$empty_line | Out-String
$empty_line | Out-String
$header_downloading = "Maintenance Is Required for the Following Flash Versions"
$coline_downloading = "--------------------------------------------------------"
Write-Output $header_downloading
$coline_downloading | Out-String
$obj_downloading_selection
$empty_line | Out-String
# Determine if there is a real need to carry on with the rest of the script.
If (($activex_is_installed -eq $true) -or ($plugin_is_installed -eq $true) -or ($pepper_is_installed -eq $true)) {
If (($downloading_activex_is_required -eq $false) -and ($downloading_plugin_is_required -eq $false) -and ($downloading_pepper_is_required -eq $false) -and ($activex_exception -eq $true)) {
Return "Please use Windows Update to update the ActiveX-version of Adobe Flash Player."
} ElseIf (($downloading_activex_is_required -eq $false) -and ($downloading_plugin_is_required -eq $false) -and ($downloading_pepper_is_required -eq $false)) {
Return "The installed Flash seems to be OK."
} Else {
$continue = $true
} # else
} Else {
Write-Warning "No Flash (ActiveX, NPAPI or PPAPI) seems to be installed on the system."
$empty_line | Out-String
$no_flash_text_1 = "This script didn't detect that any of the three types of Flash Players mentioned above"
$no_flash_text_2 = "would have been installed. Please consider installing the Flash Player by visiting"
$no_flash_text_3 = "https://get.adobe.com/flashplayer/ or https://get.adobe.com/flashplayer/otherversions/"
$no_flash_text_4 = "For full installation files please, for example, see the bottom of the page"
$no_flash_text_5 = "https://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html"
$no_flash_text_6 = "and for the Adobe Flash uninstaller, please visit"
$no_flash_text_7 = "https://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html"
Write-Output $no_flash_text_1
Write-Output $no_flash_text_2
Write-Output $no_flash_text_3
Write-Output $no_flash_text_4
Write-Output $no_flash_text_5
Write-Output $no_flash_text_6
Write-Output $no_flash_text_7
# Offer the option to install a specific version of Flash, if no Flash 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
$admin_corner = $true
$title_1 = "Install Flash (Step 1/2)"
$message_1 = "Would you like to install one of the Flash versions (ActiveX, NPAPI or PPAPI) with this script?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes: tries to download and install one of the Flash versions specified on the next step."
$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 "A&bort", "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.";
$continue = $true
}
1 {
"No. Exiting from Update-AdobeFlashPlayer script.";
Exit
}
2 {
"Exit. Exiting from Update-AdobeFlashPlayer script.";
Exit
}
3 {
"Abort. Exiting from Update-AdobeFlashPlayer script.";
Exit
}
4 {
"Cancel. Exiting from Update-AdobeFlashPlayer script.";
Exit
} # 4
} # switch
$empty_line | Out-String
$title_2 = "Install Flash (Step 2/2)"
$message_2 = "Which Flash version would you like to install?"
$activex = New-Object System.Management.Automation.Host.ChoiceDescription "&ActiveX (pre Win 8.0)", "ActiveX: tries to download and install ActiveX (for Internet Explorer prior to Windows 8.0)."
$npapi = New-Object System.Management.Automation.Host.ChoiceDescription "&NPAPI", "NPAPI: tries to download and install NPAPI (for Firefox, any Windows)."
$ppapi = New-Object System.Management.Automation.Host.ChoiceDescription "&PPAPI", "PPAPI: tries to download and install PPAPI (for Opera and Chromium-based browsers, any Windows)."
$options_2 = [System.Management.Automation.Host.ChoiceDescription[]]($activex, $npapi, $ppapi, $exit, $abort, $cancel)
$result_2 = $host.ui.PromptForChoice($title_2, $message_2, $options_2, 5)
switch ($result_2)
{
0 {
"ActiveX selected.";
$empty_line | Out-String
If ([System.Environment]::OSVersion.Version -ge '6.2') {
$downloading_activex_is_required = $false
Write-Warning "Please use Windows Update to update Adobe Flash Player(s) for Internet Explorer (ActiveX) and/or for Edge (ActiveX)."
$empty_line | Out-String
Write-Output "The Flash Player ActiveX control on Windows 8.1 and above is a component of Internet Explorer and Edge and is updated via Windows Update. By using the standalone Flash Player ActiveX installer, Flash Player ActiveX control cannot be installed on Windows 8.1 and above systems. Also, the Flash Player uninstaller doesn't uninstall the ActiveX control on Windows 8.1 and above systems. For updating the ActiveX Flash Player on Windows 8.1 and above systems, please use the Windows Update."
$empty_line | Out-String
Exit
} Else {
$activex_is_installed = $true
$activex_baseline = "[Nonexistent]"
$downloading_activex_is_required = $true
$continue = $true
} # else
}
1 {
"NPAPI selected.";
$plugin_is_installed = $true
$plugin_baseline = "[Nonexistent]"
$downloading_plugin_is_required = $true
$continue = $true
}
2 {
"PPAPI selected.";
$pepper_is_installed = $true
$pepper_baseline = "[Nonexistent]"
$downloading_pepper_is_required = $true
$continue = $true
}
3 {
"Exit. Exiting from Update-AdobeFlashPlayer script.";
Exit
}
4 {
"Abort. Exiting from Update-AdobeFlashPlayer script.";
Exit
}
5 {
"Cancel. Exiting from Update-AdobeFlashPlayer script.";
Exit
} # 5
} # switch
} Else {
Exit
} # else (Admin Corner)
} # else (No Flash)
# Check if the PowerShell session is elevated (has been run as an administrator) # Credit: alejandro5042: "How to run exe with/without elevated privileges from PowerShell"
# Note: This query (and possible exit) could be moved bit further down the script (Step 4 seems to be the first instance, which requires the elevated rights).
If (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator") -eq $false) {
$empty_line | Out-String
Write-Warning "It seems that this script is run in a 'normal' PowerShell window."
$empty_line | Out-String
Write-Verbose "Please consider running this script in an elevated (administrator-level) PowerShell window." -verbose
$empty_line | Out-String
$admin_text = "For performing system altering procedures, such as uninstalling Flash, installing Flash or writing the configuration file of Flash Player (mms.cfg) the elevated rights are mandatory. An elevated PowerShell session can, for example, be initiated by starting PowerShell with the 'run as an administrator' option."
Write-Output $admin_text
$empty_line | Out-String
# Write-Verbose "Even though it could also be possible to write a self elevating PowerShell script (https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/) or run commands elevated in PowerShell (http://powershell.com/cs/blogs/tips/archive/2014/03/19/running-commands-elevated-in-powershell.aspx) with the UAC prompts, the new UAC pop-up window may come as a surprise to the end-user, who isn't neccesarily aware that this script needs the elevated rights to complete the intended actions."
Return "Exiting without updating."
} Else {
$continue = $true
} # else
# Initiate the update process
$empty_line | Out-String
$timestamp = Get-Date -Format hh:mm:ss
$update_text = "$timestamp - Initiating the Flash Update Protocol..."
Write-Output $update_text
# Determine the current directory # Credit: JaredPar and Matthew Pirocchi "What's the best way to determine the location of the current PowerShell script?"
$script_path = Split-Path -parent $MyInvocation.MyCommand.Definition
# "Manual" progress bar variables
$activity = "Updating Flash Player"
$status = "Status"
$id = 1 # For using more than one progress bar
$total_steps = 19 # Total number of the steps or tasks, which will increment the progress bar
$task_number = 0.2 # An increasing numerical value, which is set at the beginning of each of the steps that increments the progress bar (and the value should be less or equal to total_steps). In essence, this is the "progress" of the progress bar.
$task = "Setting Initial Variables" # A description of the current operation, which is set at the beginning of each of the steps that increments the progress bar.
# Start the progress bar
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
<#
__
/_ |
| |
| |
| |
|_|
(Step 1) Download the latest full Windows installation file(s) for the Adobe Flash Player
# Note: The .msi installation files are more handy than the .exe installation files, because msi-files can be deployed over a Windows network using msiexec.exe (supporting an unattended install/uninstall) or installed interactively with software such as Microsoft Systems Management Server (SMS).
# Source 1: "Installation problems | Flash Player | Windows 7 and earlier": https://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html
# Source 2: "Adobe Flash Player Distribution" (This page and the download links will be decommissioned on Sep 29, 2016.): https://www.adobe.com/products/flashplayer/distribution3.html
# Source 3: "Where to download Flash Player for offline installation?": http://superuser.com/questions/436870/where-to-download-flash-player-for-offline-installation
# Download URL 1: https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe
# Download URL 2: https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player.exe
# Download URL 3: https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ppapi.exe
# Download URL 4: https://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_23_plugin.msi
# Download URL 5: https://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_23_plugin.exe
# Download URL 6: https://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_23_active_x.msi
# Download URL 7: https://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_23_active_x.exe
# Download URL 8: https://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_23_ppapi.msi
# Download URL 9: https://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_23_ppapi.exe
# Download URL 10: http://www.adobe.com/go/full_flashplayer_win_pl_msi
# Download URL 11: https://get.adobe.com/flashplayer/download/?installer=FP_23_for_Firefox_-_NPAPI&os=Windows%207&browser_type=Gecko&browser_dist=Firefox&dualoffer=false&mdualoffer=true&d=McAfee_Security_Scan_Plus&d=Intel_True_Key&standalone=1
#>
Write-Verbose "Downloading the latest full Windows installation file(s) for the Adobe Flash Player from Adobe..."
Write-Verbose "Depending on how many full installation files are loaded (and on the download speed), this script might take approximately 1.5 - 3 minutes to complete."
$empty_line | Out-String
$activex_url = "https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe"
$plugin_url = "https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player.exe"
$pepper_url = "https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ppapi.exe"
$activex_save_location = "$path\install_flash_player_ax.exe"
$plugin_save_location = "$path\install_flash_player.exe"
$pepper_save_location = "$path\install_flash_player_ppapi.exe"
$activex_is_downloaded = $false
$plugin_is_downloaded = $false
$pepper_is_downloaded = $false
If (($activex_is_installed -eq $true) -and ($downloading_activex_is_required -eq $true)) {
$task_number = 1
$task = "Downloading the latest full Windows installation file for the ActiveX Adobe Flash Player..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
# Purge existing old ActiveX installation files
If ((Test-Path $activex_save_location) -eq $true) {
Write-Verbose "Deleting $activex_save_location"
Remove-Item -Path "$activex_save_location"
} Else {
$continue = $true
} # else
try
{
$download_activex = New-Object System.Net.WebClient
$download_activex.DownloadFile($activex_url, $activex_save_location)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $activex_url"
$empty_line | Out-String
Return "Exiting in Step 1 (ActiveX) without updating Flash."
}
Start-Sleep -s 2
If ((Test-Path $activex_save_location) -eq $true) {
$activex_is_downloaded = $true
} Else {
$activex_is_downloaded = $false
} # else
} Else {
$continue = $true
} # else
If (($plugin_is_installed -eq $true) -and ($downloading_plugin_is_required -eq $true)) {
$task_number = 2
$task = "Downloading the latest full Windows installation file for the NPAPI Adobe Flash Player..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
# Purge existing old NPAPI installation files
If ((Test-Path $plugin_save_location) -eq $true) {
Write-Verbose "Deleting $plugin_save_location"
Remove-Item -Path "$plugin_save_location"
} Else {
$continue = $true
} # else
try
{
$download_plugin = New-Object System.Net.WebClient
$download_plugin.DownloadFile($plugin_url, $plugin_save_location)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $plugin_url"
$empty_line | Out-String
Return "Exiting in Step 1 (NPAPI) without updating Flash."
}
Start-Sleep -s 2
If ((Test-Path $plugin_save_location) -eq $true) {
$plugin_is_downloaded = $true
} Else {
$plugin_is_downloaded = $false
} # else
} Else {
$continue = $true
} # else
If (($pepper_is_installed -eq $true) -and ($downloading_pepper_is_required -eq $true)) {
$task_number = 3
$task = "Downloading the latest full Windows installation file for the PPAPI Adobe Flash Player..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
# Purge existing old PPAPI installation files
If ((Test-Path $pepper_save_location) -eq $true) {
Write-Verbose "Deleting $pepper_save_location"
Remove-Item -Path "$pepper_save_location"
} Else {
$continue = $true
} # else
try
{
$download_pepper = New-Object System.Net.WebClient
$download_pepper.DownloadFile($pepper_url, $pepper_save_location)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $pepper_url"
$empty_line | Out-String
Return "Exiting in Step 1 (PPAPI) without updating Flash."
}
Start-Sleep -s 2
If ((Test-Path $pepper_save_location) -eq $true) {
$pepper_is_downloaded = $true
} Else {
$pepper_is_downloaded = $false
} # else
} Else {
$continue = $true
} # else
<#
___
|__ \
) |
/ /
/ /_
|____|
(Step 2) Download the Flash Player Uninstaller
# Note: The EXE installer is also able to uninstall Flash at least partially, so this step could be omitted.
# Note: If .msi install files had been used with msiexec.exe the uninstaller isn't needed at all.
# Note: FlashUtil.exe (or something similar) in the C:\Windows\System32\Macromed\Flash directory ( %WINDIR%\System32\Macromed\Flash ) is also able to uninstall Flash. When using the FlashUtil<nnn>.exe to uninstall, the user is still required to use the -force argument to perform a complete uninstall.
# Description 1: "Uninstall Flash Player | Windows": https://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html#main_Download_the_Adobe_Flash_Player_uninstaller
# Description 2: "Adobe Flash Player Administration Guide": http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html
# Description 3: "Debugger version and installation troubleshooting for developers in Flash Player": https://helpx.adobe.com/flash/kb/debugger-version-installation-troubleshooting.html
# Description 4: "Silent install command line argument doesn't work | Flash Player 10.1": https://helpx.adobe.com/flash-player/kb/silent-install-command-line-argument.html
# Download URL: https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe
#>
$uninstaller_url = 'https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe'
$uninstaller_save_location = "$path\uninstall_flash_player.exe"
$uninstaller_is_downloaded = $false
$task_number = 4
$task = "Downloading the Adobe Flash Player uninstaller from Adobe..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
# Purge existing old uninstaller files
If ((Test-Path $uninstaller_save_location) -eq $true) {
Write-Verbose "Deleting $uninstaller_save_location"
Remove-Item -Path "$uninstaller_save_location"
} Else {
$continue = $true
} # else
try
{
$download_uninstaller = New-Object System.Net.WebClient
$download_uninstaller.DownloadFile($uninstaller_url, $uninstaller_save_location)
}
catch [System.Net.WebException]
{
Write-Warning "Failed to access $uninstaller_url"
$empty_line | Out-String
Return "Exiting in Step 2 without updating Flash."
}
Start-Sleep -s 2
If ((Test-Path $uninstaller_save_location) -eq $true) {
$uninstaller_is_downloaded = $true
} Else {
$uninstaller_is_downloaded = $false
} # else
<#
____
|___ \
__) |
|__ <
___) |
|____/
(Step 3) Exit all browsers and other programs that use Flash, including AOL Instant Messenger, Yahoo Messenger, MSN Messenger, or other Messengers
#>
$task_number = 5
$task = "Stopping Flash-related processes..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
Stop-Process -ProcessName '*messenger*' -ErrorAction SilentlyContinue -Force
Stop-Process -ProcessName 'FlashPlayer*' -ErrorAction SilentlyContinue -Force
Stop-Process -ProcessName 'plugin-container*' -ErrorAction SilentlyContinue -Force
Stop-Process -ProcessName 'chrome*' -ErrorAction SilentlyContinue -Force
Stop-Process -ProcessName 'opera*' -ErrorAction SilentlyContinue -Force
Stop-Process -ProcessName 'firefox' -ErrorAction SilentlyContinue -Force
Stop-Process -ProcessName 'iexplore' -ErrorAction SilentlyContinue -Force
Start-Sleep -s 5
<#
If (Get-Process iexplore -ErrorAction SilentlyContinue) {
$empty_line | Out-String
Write-Warning "It seems that Internet Explorer is running."
$empty_line | Out-String
Return "Please close the Internet Explorer and run this script again. Exiting without updating..."
} Else {
$continue = $true
} # else
#>
<#
_ _
| || |
| || |_
|__ _|
| |
|_|
(Step 4A) Uninstall Adobe Flash Player completely with uninstall_flash_player.exe
# Note: It seems that Windows PowerShell has to be run in an elevated state (Run as an Administrator) for this script to actually be able to uninstall Flash.
# Note: The standalone uninstaller from Adobe is definetly not the only way, how Flash Players can be uninstalled. Please see below for futher discussion and examples, how to uninstall Flash.
# Description 1: "Adobe Flash Player Administration Guide": http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html
# Description 2: "Silent install command line argument doesn't work | Flash Player 10.1": https://helpx.adobe.com/flash-player/kb/silent-install-command-line-argument.html
# Description 3: https://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html
# Download URL: See Step #2
#>
If (($activex_is_installed -eq $true) -and ($downloading_activex_is_required -eq $true)) {
$task_number = 6
$task = "Uninstalling the ActiveX Adobe Flash Player..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
cd $path
.\uninstall_flash_player.exe -uninstall activex | Out-Null
cd $script_path
Start-Sleep -s 5
} Else {
$continue = $true
} # else
If (($plugin_is_installed -eq $true) -and ($downloading_plugin_is_required -eq $true)) {
$task_number = 7
$task = "Uninstalling the NPAPI Adobe Flash Player..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
cd $path
.\uninstall_flash_player.exe -uninstall plugin | Out-Null
cd $script_path
Start-Sleep -s 5
} Else {
$continue = $true
} # else
If (($pepper_is_installed -eq $true) -and ($downloading_pepper_is_required -eq $true)) {
$task_number = 8
$task = "Uninstalling the PPAPI Adobe Flash Player..."
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete (($task_number / $total_steps) * 100)
cd $path
.\uninstall_flash_player.exe -uninstall pepperplugin | Out-Null
cd $script_path
Start-Sleep -s 5
} Else {
$continue = $true
} # else
<#
# Some uninstall_flash_player.exe commands:
start /wait $path\uninstall_flash_player.exe -uninstall -force
Start-Process $path\uninstall_flash_player.exe -uninstall -wait -force
To uninstall only one particular Flash Player type include the player type (active-x, plugin, or pepperplugin) as an
argument when uninstalling silently, as follows:
• ActiveX Control:
uninstall_flash_player.exe -uninstall activex
• NPAPI Plugin:
uninstall_flash_player.exe -uninstall plugin
• PPAPI Plugin:
uninstall_flash_player.exe -uninstall pepperplugin
# Alternative ways to uninstall Adobe Flash Player
# (4B) Uninstall Adobe Flash Player with the EXE installer
# Download URL: See Step #1
cd $path
.\install_flash_player.exe -uninstall | Out-Null
# (4C) Uninstall Adobe Flash Player Plugin for Firefox with FlashUtil.exe
C:\Windows\System32\Macromed\Flash\FlashUtil.exe -uninstall {activex | plugin} -force