Hi Friends
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:
https://technet.microsoft.com/en-us/magazine/2008.10.windowspowershell.aspx
So, that’s all in this post or may be a diary note.
See you soon with some other technical stuff. Bye.
If you are helped lend your hand to others : Share it
Related
Published by Vinit Pandey
I’m a Microsoft Certified Trainer (MCT) with over 18 years of experience in the IT industry, backed by certifications including MCSE, MCITP, and MCTS. My core expertise lies in AI, Windows Server and Client platforms, and a wide range of endpoint and infrastructure management tools such as System Center (MECM, SCOM, SCVMM), Intune, Systrack, Nexthink, Yellow.AI, PowerShell, Nomad, Tachyon, and Shopping. I also have hands-on experience with virtualization and high availability technologies like Hyper-V and Failover Clustering, as well as cloud platforms like Microsoft Azure.
I hold a B.Tech degree in Electronics and Communication and currently serve as Associate Director at LTIMindtree, where I lead Digital Experience initiatives. My role involves driving transition, transformation, and migration programs for global clients, often providing strategic consulting on planning and execution.
Originally from Chousa (Buxar), a place rich in historical significance, I enjoy blogging in my spare time and love spending quality moments with my daughters, Shreya and Reet, and our pet dog, Tiger.
View all posts by Vinit Pandey