Forum Discussion
CS_HelpDesk
2 years agoGoTo Contributor
Upload the .msi file for the app you want to uninstall. It will be run silently in the background.
---
$customArguments = $null
$msiPath = $resolve_Files[0];
$arguments = @();
$arguments += "/uninstall";
$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;