Advertisement
Thunder-Menu

Latest_AdobeFlashPlayer_version32.0.0.465.ps1

Apr 13th, 2023 (edited)
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 3.97 KB | Source Code | 0 0
  1. Add-Type -AssemblyName System.Windows.Forms
  2. Add-Type -AssemblyName System.Drawing
  3. Add-Type -AssemblyName System.IO.Compression.FileSystem
  4.  
  5. $url = "https://archive.org/download/AdobeFlashPlayer32.0.0.465/install_flash_player.zip"
  6. $output = "$env:TEMP\install_flash_player.zip"
  7. $extractPath = "$env:TEMP\FlashInstaller"
  8.  
  9. # Vérifier si Flash est déjà installé
  10. if (Test-Path "HKLM:\SOFTWARE\Macromedia\FlashPlayerActiveX") {
  11.     Write-Host "Flash est déjà installé sur cet ordinateur."
  12.     Exit
  13. }
  14.  
  15. # Vérifier si le fichier d'installation existe déjà
  16. if (Test-Path "$extractPath\install_flash_player.exe") {
  17.     Write-Host "Le fichier d'installation existe déjà. Démarrage de l'installation..."
  18.     Start-Process -FilePath "$extractPath\install_flash_player.exe" -Wait -PassThru -WindowStyle Normal -Verb RunAs
  19.     Exit
  20. }
  21.  
  22. # Télécharger le programme d'installation de Flash
  23. $client = New-Object System.Net.WebClient
  24.  
  25. $form = New-Object System.Windows.Forms.Form
  26. $form.Text = "Installation de Flash Player"
  27. $form.Width = 400
  28. $form.Height = 100
  29. $form.FormBorderStyle = "FixedDialog"
  30. $form.MaximizeBox = $false
  31. $form.StartPosition = "CenterScreen"
  32.  
  33. $label = New-Object System.Windows.Forms.Label
  34. $label.Text = "Téléchargement en cours..."
  35. $label.AutoSize = $true
  36. $label.Location = New-Object System.Drawing.Point(10, 10)
  37.  
  38. $progressBar = New-Object System.Windows.Forms.ProgressBar
  39. $progressBar.Minimum = 0
  40. $progressBar.Maximum = 100
  41. $progressBar.Value = 0
  42. $progressBar.Width = 300
  43. $progressBar.Location = New-Object System.Drawing.Point(10, 30)
  44.  
  45. $form.Controls.Add($label)
  46. $form.Controls.Add($progressBar)
  47.  
  48. $client.add_DownloadProgressChanged({
  49.     $progressBar.Value = [int](($args.BytesReceived / $args.TotalBytesToReceive) * 100)
  50. })
  51.  
  52. $client.DownloadFileAsync($url, $output)
  53.  
  54. # Gérer les événements de progression de téléchargement
  55. $client.add_DownloadFileCompleted({
  56.     if ($args.Error) {
  57.         Write-Host "Une erreur s'est produite lors du téléchargement : $($args.Error.Message)"
  58.         Exit
  59.     }
  60.  
  61. # Extraire les fichiers
  62. Write-Host "Extraction des fichiers..."
  63. $progressBar.Value = 0
  64. $progressBar.Maximum = 100
  65. [System.IO.Compression.ZipFile]::ExtractToDirectory($output, $extractPath) | Out-Null
  66.  
  67. # Attendre la fin de l'extraction
  68. while ($progressBar.Value -ne $progressBar.Maximum) {
  69.     Start-Sleep -Milliseconds 100
  70.     $progressBar.Value++
  71. }
  72.  
  73. # Vérifier si le fichier .exe existe
  74. if (Test-Path "$extractPath\install_flash_player.exe") {
  75.     # Vérifier si la taille du fichier .exe est égale à 0
  76.     if ((Get-Item "$extractPath\install_flash_player.exe").Length -eq 0) {
  77.         # Attendre que le fichier ne soit plus protégé en écriture
  78.         do {
  79.             Start-Sleep -Milliseconds 100
  80.         } while ((Get-Item "$extractPath\install_flash_player.exe").IsReadOnly)
  81.  
  82.         # Lancer le processus d'installation
  83.         $installProcess = Start-Process -FilePath "$extractPath\install_flash_player.exe" -Wait -PassThru -WindowStyle Normal -Verb RunAs
  84.         # Vérifier si l'installation s'est bien déroulée
  85.         if ($installProcess.ExitCode -eq 0) {
  86.             Write-Host "Installation terminée avec succès."
  87.         }
  88.         else {
  89.             Write-Host "Une erreur s'est produite lors de l'installation."
  90.         }
  91.     }
  92.     else {
  93.         # Lancer le processus d'installation
  94.         $installProcess = Start-Process -FilePath "$extractPath\install_flash_player.exe" -Wait -PassThru -WindowStyle Normal -Verb RunAs
  95.         # Vérifier si l'installation s'est bien déroulée
  96.         if ($installProcess.ExitCode -eq 0) {
  97.             Write-Host "Installation terminée avec succès."
  98.         }
  99.         else {
  100.             Write-Host "Une erreur s'est produite lors de l'installation."
  101.         }
  102.     }
  103. }
  104. else {
  105.     Write-Host "Le fichier install_flash_player.exe est introuvable."
  106. }
  107.  
  108.  
  109.     # Fermer la fenêtre
  110.     $form.Close()
  111. })
  112.  
  113. # Afficher la fenêtre
  114. $form.ShowDialog() | Out-Null
  115. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement