Powershell Start-process -Argument list not working

powershellpowershell-v3.0

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:

Get-Content install-list.txt | Where-Object {$_ -like "*.msu} | Foreach-Object {
    wusa $_ /quiet /norestart >> "c:\script\installupdates.log" | Wait-Process
}

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!