Install multiple .MSU packages

# This snippet installs all .MSU files in a given path

# Notes:
#      -Run this script / ISE as administrator
#      -Update the path for the MSU's prior to execution

# Obtain all .MSU files in a given path
$Dir = (Get-Item -Path "\\FileServer.domain.local\share" -Verbose).FullName
 # Loop through each .MSU file
 Foreach($Item in (ls $Dir *.msu -Name))
    # Write the item to the screen so the operator know what is being worked on
    Write-Host "Starting on $Item" -ForegroundColor Magenta
    Write-Host "." 
    Write-Host "."
    # Use the Windows Update Standalone Installer (WUSA) to execute
    $item = $Dir + "\" + $Item
    wusa $Item /quiet /norestart | Out-Null
    Write-Host "Completed. Moving on..." -ForegroundColor Green
    Write-Host "."  
    Write-Host "." 

Write-Host "Done with everything. Should probably reboot..." -ForegroundColor Green -BackgroundColor Black

Leave a Reply

Your email address will not be published. Required fields are marked *