Powershell v2 CTP3 - profiles
I wanted to change the colours for powersshell error messages. Easily done by using this code
# Set Error and warning colours $hostprivate = (Get-Host).PrivateData $hostprivate.ErrorBackgroundColor = "red"
First i put the code in Profile.ps1 in C:\Documents and Settings\myname\Mina dokument\WindowsPowerShell.
This caused the powerhell scripting environment (ISE) to spit out some errors while starting:
Property ‘ErrorBackgroundColor’ cannot be found on this object; make sure it exists and is settable.
At C:\Documents and Settings\maga\Mina dokument\WindowsPowerShell\profile.ps1:201 char:14
+ $hostprivate. <<<< ErrorBackgroundColor = “magenta”
+ CategoryInfo :
InvalidOperation: (ErrorBackgroundColor:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
To solve it, put the codelines in Microsoft.PowerShell_profile.ps1 instead.