PowerShell: Simple Profile

Posted on Updated on

I’ve read a lot of different posts, articles and listened to any different Power Users tell me how to set up my PS profile. What I have seen is that a lot, if not most people want to trick up their profile adding all kinds of cool things that just increase the load time of the PowerShell console. You can import modules when you need them, you can update help when you need it. You get my point.

I believe simple is better, including just enough to make it work and that’s not much at all. Lets see what I have in my PS profile:

set-location c:\Powershell
$a = (Get-Host).PrivateData
$a.ErrorForegroundColor = “green”

Four lines, that’s it, but what do they do?

  1. set-location “Path” Just drops me in my PowerShell folder that all my scripts are in.
  2. $a = (Get-Host).PrivateData sets a variable so that I can change colors by accessing the ChildObject PrivateData to assign a different color to different things in the PS window.
  3. $a.ErrorForegroundColor = “green” uses the $a to add the ErrorForegroundColor so that I can assign it a value of  green. You can do more with assigning cmdlets to variables but that isn’t the lesson here.
  4. cls is because I like a a clean workspace while I work.

That’s my whole profile. Nothing spectacular, or even ingenious. I just want to get working and I hate the RED error messages. Green looks so much better.