Hi,
I am looking to change the background and foreground colors of only specific table entries, based on their value. What I am finding so far is that it changes the colors for everything. Here is what I have so far:
foreach($displayname in $InputObject){
[pscustomobject]@{
"Group Name" = $InputObject.displayname
"Members" = if((($InputObject.members).count) -gt ((Get-UnifiedGroupLinks "gr-$($InputObject.displayname)" -LinkType members | select name).count))
{
$bc = (Get-Host).UI.RawUI
$Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'yellow')
write-output ($InputObject.members).count
$host.ui.RawUI.BackgroundColor = $bc
}
else{
($InputObject.members).count
}
"Prod Group" = Get-UnifiedGroup "gr-$($InputObject.displayname)" | select -ExpandProperty displayname
"Prod Members" = (Get-UnifiedGroupLinks "gr-$($InputObject.displayname)" -LinkType members | select name).count
}
So ideally, with the following output:
Group Name Members Prod Group Prod Members ---------- ------- ---------- ------------ testgroup1 5 gr-testgroup1 5 testgroup2 5 gr-testgroup2 4
The 5 in testgroup2 only would be changed, but the rest would be standard colors. With the code above, all the text changes.
Thanks for your consideration.