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.
If you are helped lend your hand to others : Share it
Published by Vinit Pandey
I am Microsoft Certified Trainer ( MCT) with couple of other certifications including MCSE, MCITP and MCTS. My core technologies are Windows Servers and clients, System Center products including MECM, Intune, Systrack, Nexthink, Yellow.AI, PowerShell, Nomad, Tachyon, Shopping, SCOM, SCVMM, Hyper-V, Failover Clustering and Azure. I have done B.Tech in electronics and communication stream. I have total 15+ experience in IT field. Presently, I am working with Larsen and Toubro Infotech as Experience Architect. My job includes transition, transformation and migration activities which we perform for our esteemed clients. Often I need to provide consultancy to my clients in migration and planning projects.
I am from Chousa (Buxar) which has a lot of historical significance. In my free time I love to blog and play with Shreya (my daughter) and Tiger ( my pet dog).
View all posts by Vinit Pandey