Forum posts for msiexec.exe

PSRemotingTransportException when calling Start-Process “MsiExec.exe” on remote machine

I am trying to run the following command on a remote computer to uninstall the previous version of a product before I install another version. This is uninstalling using MsiExec.exe.

Whenever I call Start-Process, the process actually runs and the product is uninstalled on the remote computer, but I get the below exception thrown. If the product is not already installed and the Start-Process line does not run, the remote command works fine with no thrown exception. (i.e. it actually searches the registry, does not find the product, and returns -1 without throwing an exception) The problem only arises when Start-Process is called.

Here's my script code...

$UninstallScriptBlock = {
param ( [string]$InstallerProductName )

$ErrorActionPreference = 'Stop';

$UninstallRegPath = 'Registry::HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall';
$ProductCode = Get-ChildItem -Path $UninstallRegPath | foreach { if ($_.GetValue('DisplayName') -eq $InstallerProductName) { [System.IO.Path]::GetFileName($_); } }
if ([string]::IsNullOrEmpty($ProductCode))
{
$UninstallRegPath = 'Registry::HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall';
$ProductCode = Get-ChildItem -Path $UninstallRegPath | foreach { if ($_.GetValue('DisplayName') -eq $InstallerProductName) { [System.IO.Path]::GetFileName($_); } }
}
if ([string]::IsNullOrEmpty($ProductCode))
{
return -1;
}

$Process = Start-Process -Wait -Passthru -FilePath 'MsiExec.exe' -ArgumentList '/X', $ProductCode, '/qn';
return $Process.ExitCode;
}

[int]$UninstallReturnCode = Invoke-Command -ComputerName $Server -ScriptBlock $UninstallScriptBlock -ArgumentList $InstallerProductName -SessionOption (New-PSSessionOption -OperationTimeout 0);


And the thrown exception...

Processing data for a remote command failed with the following error message: The I/O operation has been aborted because of either a thread exit or an application request. For more information, see the about_Remote_Troubleshooting Help topic.
At [Undisclosed]
+ [int]$UninstallReturnCode = Invoke-Command -ComputerName $Server -ScriptBloc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: ([UndisclosedServerName]:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName : [UndisclosedServerName]


And the formatted error...

ErrorCode : 995
TransportMessage : The I/O operation has been aborted because of either a thread exit or an application request.

ErrorRecord : Processing data for a remote command failed with the following error message: The I/O
operation has been aborted because of either a thread exit or an application request. For
more information, see the about_Remote_Troubleshooting Help topic.
StackTrace :
WasThrownFromThrowStatement : False
Message : Processing data for a remote command failed with the following error message: The I/O
operation has been aborted because of either a thread exit or an application request. For
more information, see the about_Remote_Troubleshooting Help topic.
Data : {}
InnerException :
TargetSite :
HelpLink :
Source :

View complete forum thread with replies

Other posts related to msiexec.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

how to kill msiexec.exe in wix?
How to use msiexec.exe to uninstall a application? [duplicate]
Cannot open Windows Installer (msiexec.exe)
How to use msiexec.exe to remove a Windows installer
Update msi installer from msiexec.exe command line
C# Setup Project - Faulting Application msiexec.exe, Faulting Module kernel32.dll
WIX 3.8 msiexec.exe /quiet Error 1603
How to write bootstrap EXE, which launch MSIEXEC.EXE and then wait for its completion
PSRemotingTransportException when calling Start-Process “MsiExec.exe” on remote machine
Visual Studo 2010: Windows Installer using msiexec.exe returns MSI Error 2727
How to analyze the logfile in “msiexec.exe /i your.msi /L*v c:logfile.txt” inorder to fix e…
msiexec.exe intermittently fails to uninstall
NSIS: Failed to install using msiexec.exe
WiX: Change MsiExec.exe error message (not Windows Installer error messages)

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.