Start-Transcript c:\scripts\InstallUpdates.log -Append # -NoClobber
$SourceMSUFiles = (get-content install-list.txt | where {$_ -like "*.msu"})
#Install MSU files
foreach($file in $SourceMSUFiles)
{
$Argument= "$Files",' /quiet',' /norestart'
& start wusa -ArgumentList @Argument -Wait # -RedirectStandardOutput "c:\scripts\InstallUpdates.log"
Write-Host "Installing $file" `n
}
stop-transcript
In normal cmd line this would work like this:
wusa $files /quiet /norestart
I want to use Powershell to do what I would normally do with command line.
Best Answer
You can just use the same command actually. Or were you after something more idiomatic? I think it's easier to start executables using the CMD syntax, unless you see some strange errors (K.I.S.S.). Even redirection works:
When I tried this against bogus updates, the log file was empty. I think this might be to do with the quiet option. It seems quiet in the command line too!