Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

return $Error – font color is white?

$
0
0

Hi all,

In a module I’m writing, I have a function that handles my errors by taking an [ErrorRecord] as input, doing some things with it, and then returning that same input [ErrorRecord]. For example, one of the things that happens is editing the ErrorDetails property in a certain way.

Ultimately, after handling the error, I want to return it to the pipeline.

Oddly, when the error is returned (after running through the function), even though its data type is [ErrorRecord] still, the output is white. Anyone know how to make these output as red?

Here is some pseudo-similar code you can run to test it out. Also, I’m on Win7 with PowerShell version 5.0 in case that makes the difference.

https://pastebin.com/pKA0DwaN

submitted by /u/Soxcks13
[link] [comments]

The post return $Error – font color is white? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles