Product, version and build: Powershell Studio 4.1.75
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64
Operating system: Windows 7
32 or 64 bit OS: 64
PowerShell Version: 4,0
I have the following lines of code in my profile.ps1 script in C:\Windows\System32\WindowsPowerShell\v1.0:
$Host.PrivateData.DebugBackgroundColor = "Black"
$Host.PrivateData.DebugForegroundColor = "Yellow"
$Host.PrivateData.ErrorBackgroundColor = "Black"
$Host.PrivateData.ErrorForegroundColor = "Orange"
When I run the regular posh IDE, it works just fine. But when the profile runs in Studio, I get an error message regarding the color, Orange:
Exception setting "ErrorForegroundColor": "Cannot convert value "Orange" to
type "System.ConsoleColor". Error: "Unable to match the identifier name Orange
to a valid enumerator name. Specify one of the following enumerator names and
try again: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta,
DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White""
At C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1:19 char:1
+ $Host.PrivateData.ErrorForegroundColor = "Orange"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationExceptio
n
+ FullyQualifiedErrorId : ExceptionWhenSetting
What's going on? Is the profile in Studio running after powershell is already loaded? And maybe the one in the microsoft IDE runs before it loads powershell?
profile issue
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: profile issue
You are running host dependent code. Meaning that the ISE host has these properties, but the PowerShell Studio host does not. Chances are any host outside of ISE will not have these properties.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: profile issue
I'm confused, David. In another forum post, you assured the poster that Studio was running the same powershell code as he used with the M$ IDE. Are you guys modifying the code that outputs to the console for powershell? Also, why do my other colors work right? Orange is the only one that balks.
Re: profile issue
The host is different than the PowerShell engine. The host is the intermediary layer between the user and the PowerShell engine. The PowerShell ISE is its own host and the console is another host. Therefore, context makes the difference.
Are you referring to the embedded console or PowerShell Studio's internal host? Because PowerShell Studio's internal host does not use a console to display output.
Are you referring to the embedded console or PowerShell Studio's internal host? Because PowerShell Studio's internal host does not use a console to display output.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.