Advertisement
ZergRushA

KB5031356/KB5029244 manual installer

Nov 20th, 2023
1,194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $cve_2023_36602 = wmic qfe list | Select-String -Pattern 'KB5031356'
  2. $cve_2023_35380 = wmic qfe list | Select-String -Pattern 'KB5029244'
  3.  
  4. $url_2023_35380 = 'https://catalog.s.download.windowsupdate.com/c/msdownload/update/software/secu/2023/08/windows10.0-kb5029244-x64_fb8cdde229cf17755c2c890a12e0e8f252dd38c0.msu'
  5. $url_2023_36602 = 'https://catalog.s.download.windowsupdate.com/d/msdownload/update/software/secu/2023/10/windows10.0-kb5031356-x64_65d5bbc39ccb461472d9854f1a370fe018b79fcc.msu'
  6.  
  7.  
  8. #To get current os version (OS = build + UBR), combine the following
  9. #$build = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name CurrentBuild).CurrentBuild
  10. #$ubr = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name UBR).UBR
  11. #$OSVersion = $build + '.' + $ubr
  12.  
  13.  
  14. if(($cve_2023_36602) -and ($cve_2023_35380)){
  15.     Write-Output "Both hotfixes were found. No need for installation"
  16. }
  17. elseif(($cve_2023_36602) -and ($cve_2023_35380 -eq $null)){
  18.     Write-Output "Hotfix for CVE-2023-35380 (KB5029244) wasn't found", "Started downloading msu file"
  19.  
  20.     New-Item -Path "C:\" -Name "stored_msu" -ItemType Directory
  21.  
  22.     $folder_path_cve_2023_35380 = "C:\stored_msu\windows10.0-kb5029244-x64_fb8cdde229cf17755c2c890a12e0e8f252dd38c0.msu"
  23.    
  24.     $ProgressPreference = 'SilentlyContinue'
  25.     Invoke-WebRequest $url_2023_35380 -outfile $folder_path_cve_2023_35380
  26.     Write-Output "Hotfix file downloaded successfully", "Installing hotfix. It might take some time"
  27.     Start-Process -FilePath "wusa.exe" -ArgumentList "C:\stored_msu\windows10.0-kb5029244-x64_fb8cdde229cf17755c2c890a12e0e8f252dd38c0.msu /quiet /norestart" -Wait -PassThru -NoNewWindow
  28.     Write-Output "Done. Please restart your device in order to apply hotfix"
  29. }
  30. elseif(($cve_2023_36602 -eq $null) -and ($cve_2023_35380)){
  31.     Write-Output "Hotfix for CVE-2023-36602 (KB5031356) wasn't found", "Started downloading msu file"
  32.  
  33.     New-Item -Path "C:\" -Name "stored_msu" -ItemType Directory
  34.  
  35.     $folder_path_cve_2023_36602 = "C:\stored_msu\windows10.0-kb5031356-x64_65d5bbc39ccb461472d9854f1a370fe018b79fcc.msu"
  36.    
  37.     $ProgressPreference = 'SilentlyContinue'
  38.     Invoke-WebRequest $url_2023_36602 -outfile $folder_path_cve_2023_36602
  39.     Write-Output "Hotfix file downloaded successfully", "Installing hotfix. It might take some time"
  40.     Start-Process -FilePath "wusa.exe" -ArgumentList "C:\stored_msu\windows10.0-kb5031356-x64_65d5bbc39ccb461472d9854f1a370fe018b79fcc.msu /quiet /norestart" -Wait -PassThru -NoNewWindow
  41.     Write-Output "Done. Please restart your device in order to apply hotfix"
  42. }
  43. else{
  44.     Write-Output "None of the hotfixes were found", "Started downloading msu files"
  45.     New-Item -Path "C:\" -Name "stored_msu" -ItemType Directory
  46.    
  47.     $folder_path_cve_2023_35380 = "C:\stored_msu\windows10.0-kb5029244-x64_fb8cdde229cf17755c2c890a12e0e8f252dd38c0.msu"
  48.     $folder_path_cve_2023_36602 = "C:\stored_msu\windows10.0-kb5031356-x64_65d5bbc39ccb461472d9854f1a370fe018b79fcc.msu"
  49.    
  50.     $ProgressPreference = 'SilentlyContinue'
  51.     Write-Output "Downloading hotfix for CVE-2023-35380"
  52.     Invoke-WebRequest $url_2023_35380 -outfile $folder_path_cve_2023_35380
  53.     Write-Output "Hotfix file downloaded successfully"
  54.    
  55.     Write-Output "Downloading hotfix for CVE-2023-36602"
  56.     Invoke-WebRequest $url_2023_36602 -outfile $folder_path_cve_2023_36602
  57.     Write-Output "Hotfix file downloaded successfully"
  58.    
  59.     Write-Output "Installing hotfixes. It might take some time"
  60.     Start-Process -FilePath "wusa.exe" -ArgumentList "C:\stored_msu\windows10.0-kb5029244-x64_fb8cdde229cf17755c2c890a12e0e8f252dd38c0.msu /quiet /norestart" -Wait -PassThru -NoNewWindow
  61.     Write-Output "One left hotfix left."
  62.     Start-Process -FilePath "wusa.exe" -ArgumentList "C:\stored_msu\windows10.0-kb5031356-x64_65d5bbc39ccb461472d9854f1a370fe018b79fcc.msu /quiet /norestart" -Wait -PassThru -NoNewWindow
  63.     Write-Output "Done. Please restart your device in order to apply hotfixes"
  64.    
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement