http://blogs.technet.com/b/heyscriptingguy/archive/2014/05/21/what-39-s-in-your-powershell-profile-users-39-favorites-part-2.aspx
Today, I want to share what's in my profile. I've customized it a bit more since then.
Here' what it has :
- Change Error color to Gray from default red. It stresses me to see RED RED on the prompt.
- Changing the location to my scripts folder to : Easily call my common scripts, Prevent accidental changes to system32 folder.
- Checking if I've launched Power Shell as an Admin or not.
- Customizing in-built PROMPT function to show ADMIN/DBG mode and increment command number after each command run.
Want to know what Power Shell MVP's have ? See here.
If you don't know about profile, in simple terms I'll try to explain.
It's an auto-loading PS1 file which runs each time Power Shell starts. Whatever is written in it is executed and then you can see prompt. the environment variable $Profile tells you the path of the file.
To bypass loading profile, powershell.exe has a parameter called -NoProfile. It's a best practice to use this. If an attacker has control of your system, he can change PROFILE and run arbitrary code. Also, your code may behave differently if someone has changed some functions in it.