I'm using a fubction to get output to file and I'm trying to find a way to have the output on the console colored, is that possible?
It depends a bit how the output on the console is created.
Is that with Write-Host, then you can use the Foreground and Background parameters.
If you are talking about error, warning, verbose, debug ... messages, you can change the values in the corresponding properties in $host.PrivateData.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD
I'm using a function to log output to file , so if I have understood correctly shall I add this parametre $host.PrivateData to my function or I need to create another one?
is there some samples to check and learn from it?:smileyblush:
Like it said earlier, it depends on how that output in that function is generated.
Is that via Write-Host?
If it is the colours of the standard messages (error, warning ...), you can use the $host.PrivateData properties.
See for example Change the PowerShell Colors
It would help if you show the code that generates the output.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference