Install MSU files using Powershell

INTRODUCTION

Sometimes you need to install a list of hotfixes, provided as *.MSU files by Microsoft. KB articles already installed will, by default, fail.

In this blog post, I provide a Powershell script you can use to install a list of MSU files.

THE POWERSHELL SCRIPT

The Powershell script provided below takes the KB articles on the list and only install those not already installed.

Just modify the Powershell script according to your requirements.

#Source folder
$SourceFolder = "c:temp"

#Crete new Powershell object
$KBArrayList = New-Object -TypeName System.Collections.ArrayList 

#Mofify KB article list
$KBArrayList.AddRange(@("KB2775511""KB2533623","KB2639308","KB2670838","KB2729094","KB2731771","KB2786081","KB2834140","KB2882822","KB2888049","")) 

foreach ($KB in $KBArrayList) { 
    if (-not(Get-Hotfix -Id $KB)) { 
        Start-Process -FilePath "wusa.exe" -ArgumentList "$SourceFolder$KB.msu /quiet /norestart" -Wait } 
} 

REFERENCES

RELATED POSTS

POWERSHELL BOOKS

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here