Following approach should work to be used as scripblock, you will need to find a way for your package to perform the $logcheck, either event log or a file. This sample had MS Office unistall.
Note, if you are planning to run it on large number of workstations/regularly I would suggest to replace while($true) with finite for loop or timelapse.
I have also placed your execution script as is, but for me msiexec.exe worked without need to do PowerShell
$scriptUninstallApp = {
Start-Process powershell -Verb runAs {msiexec.exe '/i' "C:\Users\file.msi", '/passive'}
$logcheck = ""
while($true)
{
if($logcheck -match "Windows Installer removed the product")
{
return
}
else
{
start-sleep -Seconds 1
[string]$logcheck = get-eventlog -logname application -newest 10 -Source msiinstaller | ?{$_.message -like "*Windows Installer removed the product. Product Name: Microsoft Office*"} | select -ExpandProperty message
}
}
}
Invoke-Command -Credential(Get-Credential) -ComputerName $computer -ScriptBlock $scriptUninstallApp
-WaittoStart-Processas shown in here: stackoverflow.com/questions/25407353/…. If won't work, there is another trick I can post