Skip to content

7.4.0 Start-Process with -PassThru & -RedirectStandardOutput does not return the process object completely ( properties like Exitcode ) #20716

@derkveenhof

Description

@derkveenhof

Prerequisites

Steps to reproduce

When i use Start-Process with -PassThru & -RedirectStandardOutput , the process object is not returned completely. This has been since 7.4.0

Expected behavior

This was the 7.3.9 behavior:

PS C:\Users\thiscouldbeme> $Process = start-process notepad -PassThru -wait -RedirectStandardOutput c:\temp\sa.txt
PS C:\Users\thiscouldbeme> $Process | Select *

Name                       :
Id                         : 33776
PriorityClass              :
FileVersion                :
HandleCount                :
WorkingSet                 :
PagedMemorySize            :
PrivateMemorySize          :
VirtualMemorySize          :
TotalProcessorTime         : 00:00:00
SI                         :
Handles                    :
VM                         :
WS                         :
PM                         :
NPM                        :
Path                       :
CommandLine                :
Parent                     : System.Diagnostics.Process (pwsh)
Company                    :
CPU                        : 0
ProductVersion             :
Description                :
Product                    :
__NounName                 : Process
SafeHandle                 : Microsoft.Win32.SafeHandles.SafeProcessHandle
Handle                     : 2500
BasePriority               :
ExitCode                   : 0
HasExited                  : True
StartTime                  : 17-11-2023 18:31:48
ExitTime                   : 17-11-2023 18:31:50
MachineName                : .
MaxWorkingSet              :
MinWorkingSet              :
Modules                    :
NonpagedSystemMemorySize64 :
NonpagedSystemMemorySize   :
PagedMemorySize64          :
PagedSystemMemorySize64    :
PagedSystemMemorySize      :
PeakPagedMemorySize64      :
PeakPagedMemorySize        :
PeakWorkingSet64           :
PeakWorkingSet             :
PeakVirtualMemorySize64    :
PeakVirtualMemorySize      :
PriorityBoostEnabled       :
PrivateMemorySize64        :
ProcessorAffinity          :
SessionId                  :
StartInfo                  :
Threads                    :
VirtualMemorySize64        :
EnableRaisingEvents        : False
StandardInput              :
StandardOutput             :
StandardError              :
WorkingSet64               :
SynchronizingObject        :
MainModule                 :
PrivilegedProcessorTime    : 00:00:00
UserProcessorTime          : 00:00:00
ProcessName                :
MainWindowHandle           : 0
MainWindowTitle            :
Responding                 : True
Site                       :
Container                  :

Actual behavior

PS C:\Windows\System32> $Process = start-process notepad -PassThru -wait -RedirectStandardOutput c:\temp\sa.txt
PS C:\Windows\System32> $Process | Select *

Name                       :
Id                         : 3264
PriorityClass              :
FileVersion                :
HandleCount                :
WorkingSet                 :
PagedMemorySize            :
PrivateMemorySize          :
VirtualMemorySize          :
TotalProcessorTime         :
SI                         :
Handles                    :
VM                         :
WS                         :
PM                         :
NPM                        :
Path                       :
CommandLine                :
Parent                     :
Company                    :
CPU                        :
ProductVersion             :
Description                :
Product                    :
__NounName                 : Process
SafeHandle                 :
Handle                     :
BasePriority               :
ExitCode                   :
HasExited                  : True
StartTime                  :
ExitTime                   :
MachineName                : .
MaxWorkingSet              :
MinWorkingSet              :
Modules                    :
NonpagedSystemMemorySize64 :
NonpagedSystemMemorySize   :
PagedMemorySize64          :
PagedSystemMemorySize64    :
PagedSystemMemorySize      :
PeakPagedMemorySize64      :
PeakPagedMemorySize        :
PeakWorkingSet64           :
PeakWorkingSet             :
PeakVirtualMemorySize64    :
PeakVirtualMemorySize      :
PriorityBoostEnabled       :
PrivateMemorySize64        :
ProcessorAffinity          :
SessionId                  :
StartInfo                  :
Threads                    :
VirtualMemorySize64        :
EnableRaisingEvents        : False
StandardInput              :
StandardOutput             :
StandardError              :
WorkingSet64               :
SynchronizingObject        :
MainModule                 :
PrivilegedProcessorTime    :
UserProcessorTime          :
ProcessName                :
MainWindowHandle           : 0
MainWindowTitle            :
Responding                 : True
Site                       :
Container                  :

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-FixedThe issue is fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions