I am trying to uninstall an application from within Powershell V2 on a remote machine. To call the uninstallation I am using the [WMICLASS]
Accelerator, due to the fact PSRemoting is not supported in our domain ex:
@([WMICLASS]"\\$computerName\ROOT\CIMV2:win32_process").Create("msiexec.exe `/x{$GUID `/norestart `/qn")
I can successfully execute the process and receive a return value of 0
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 2
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ProcessId : 9580
ReturnValue : 0
PSComputerName :
The issue I have is there seems to be no obvious way to grab the output of that process and return it to my current shell
one option, although not exactly what I want is
.Create("cmd /c msiexec.exe `/x{$GUID} `/norestart `/qn > $MyLog")
Get-Content -Path \\$ComputerName\$MyLog
I would prefer a way to redirect the STDOUT\STDERR to my shell without creating a file and then reading from that file. Is this possible?