Skip to content

Get-Error populates $Error variable #11228

@kvprasoon

Description

@kvprasoon

Steps to reproduce

Open a new pwsh

$Error
Get-Process blah

$Error

Get-Error

$Error

Expected behavior


$Error # no output expected
Get-Process blah

$Error # previous and only one error in output

Get-Error # gets the previous error in detailed error output

$Error # only one error in output expected

Actual behavior

$Error # no output expected
Get-Process blah

$Error # previous and only one error in output

Get-Error # gets the previous error in detailed error output

$Error # actual error and Get-Error output both captured in this variable

Environment data


Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Microsoft Windows 10.0.19033
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions