Forum Discussion
CS_HelpDesk
2 years agoGoTo Contributor
Upload an .msi file that will be run silently in the background.
---
$customArguments = $null
$msiPath = $resolve_Files[0];
$arguments = @();
$arguments += "/i";
$arguments += '"' + $msiPath + '"';
$arguments += "/quiet";
if ($noRestart)
{
$arguments += "/norestart";
}
$logFileId = New-Guid;
$logFilePath = "$logFileId.log";
$arguments += "/l*";
$arguments += '"' + $logFilePath + '"';
if ($customArguments)
{
$arguments += $customArguments;
}
$msiExec = "msiexec.exe";
$process = Start-Process $msiExec -ArgumentList $arguments -Wait -NoNewWindow -PassThru;
if (Test-Path $logFilePath)
{
Get-Content -Path $logFilePath;
}
Exit $process.ExitCode;