This is going to be short blog about how we can change the color of error messages in PowerShell. By default its in “Red” and at least to me its scary. This is how it looks:
Good news is that we can change this color and not only error but we can change warning color, background color and so on. These setting are in “private data” property of “$host”. Lets have a look.
So to change it use this cmdlet: $host.PrivateData.ErrorForegroundColor = ‘White’. I have changed color to white you can also use some other color. And here is the new look:
Isn’t it awesome.
Note: This change is only for the current session of shell. Once you close and reopen, changes are gone. To make it permanent you need to use “profile”. Have you said “Whats profile ?”. For those who questioned, here is the answer:
So, that’s all in this post or may be a diary note.
See you soon with some other technical stuff. Bye.