Skip to main content

Hey Guys,



Here is a quick worklet I wrote that I’ve been using to fix the MS BSOD error. Please let me know your thoughts, looking to improve my coding skills.



Evaluation Code:



#KBs that want to query for

$kb = '5000802'

$kb2 = '5001567'



# Checks for installed KB

$installed = Get-HotFix -Id "KB$kb" -ErrorAction SilentlyContinue

$installed2 = Get-HotFix -ID "KB$kb2" -ErrorAction SilentlyContinue





if (( $installed )) {

Exit 1

}elseif($installed2){

exit 0

#exits with output in the report

write-host = "$kb2 patch Installed"

} else {

Exit 0

#exits but can view the output via the report.

Write-Host = "$kb Not installed"

}



Remediation Code:



$SF = "C:\"

$file = 'windows10.0-kb5001567.msu'

$kb = '5000802'

$installed = Get-HotFix -ID "KB$kb2" -ErrorAction SilentlyContinue



if($installed){

Copy-Item .\$file -Destination "$SF\$file"

Start-Process -FilePath "wusa.exe" -ArguementList "$SF\$file /quiet /norestart" -wait

Remove-Item $SF\$file

}Else{

write-host = 'patch installed'}



You can upload the file to and just adjust the code to patch other KBs.

Looks good! Thanks!


Reply