Install example with log:
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$Path\x64\$msiFile`" /qn /L*v `"$Path\$File.log`"" -Wait
Check log:
$statusLine = Get-Content "$Path\$File.log" -Tail 20 | Where-Object { $_ -match "Productnaam:" }
if ($statusLine) {
Write-Host $statusLine
if ($statusLine -match ": 0\.$") {
Write-Host "Installation successful" -ForegroundColor Green
} else {
Write-Host "Installation failed" -ForegroundColor Red
}
} else {
Write-Host "Status line not found" -ForegroundColor Red
}