Reputation: 387
The color for '$obj | Out-Default' is always white. Write-Host lets you select -ForegroundColor * -BackgroundColor. But it doesn't show the object nice.
Test object
$obj = [PSCustomObject]@{
String = "A"
Num = 6
}
out-default
String Num
------ ---
A 6
write-host
@{String=A; Num=6}
Upvotes: 2
Views: 131
Reputation: 387
This is not my answer, it is Mathias R. Jessen's.
Use Write-Host
in conjunction with Out-String
; e.g.:
Write-Host ($obj |Out-String) -ForegroundColor Cyan
Upvotes: 4