# List of remote computers
$Computers = @(
"PC01",
"PC02",
"PC03"
)
# Source files location
$SourcePath = "\\FileServer\Updates"
# Update files
$SSUFile = "SSU-26100.8648-x64.cab"
$MSUFile = "windows11.0-kb5094126-x64.msu"
# Remote temp folder
$RemoteTemp = "C$\Temp\Updates"
foreach ($Computer in $Computers) {
Write-Host "Processing $Computer ..." -ForegroundColor Cyan
# Create remote folder
Invoke-Command -ComputerName $Computer -ScriptBlock {
New-Item -Path "C:\Temp\Updates" -ItemType Directory -Force | Out-Null
}
# Copy files
Copy-Item "$SourcePath\$SSUFile" "\\$Computer\$RemoteTemp\" -Force
Copy-Item "$SourcePath\$MSUFile" "\\$Computer\$RemoteTemp\" -Force
# Install updates remotely
Invoke-Command -ComputerName $Computer -ScriptBlock {
$SSU = "C:\Temp\Updates\SSU-26100.8648-x64.cab"
$MSU = "C:\Temp\Updates\windows11.0-kb5094126-x64.msu"
Write-Host "Installing SSU..."
dism /Online /Add-Package /PackagePath:$SSU /Quiet /NoRestart
Write-Host "Installing MSU..."
wusa.exe $MSU /quiet /norestart
}
Write-Host "$Computer completed." -ForegroundColor Green
}
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin