Проблема в том, что вы работаете с таблицей.
Вы можете изменить всю таблицу на красный или просто добавить предупреждение красным.
Я бы просто поставил предупреждение красным.
$table=Get-ADUser $User1 -Properties Name, Enabled, UserPrincipalName, LastLogonDate, Modified | Select Name, Enabled, UserPrincipalName, LastLogonDate, Modified
$orginal=[console]::ForegroundColor
if ( $table.LastLogonDate -gt $table.Modified) {
Write-Host -ForegroundColor Red "Warning! - Put info here!"
}
Если вы хотите изменить весь цвет консоли и вернуть его обратно, это вариант
$table=Get-ADUser $User1 -Properties Name, Enabled, UserPrincipalName, LastLogonDate, Modified | Select Name, Enabled, UserPrincipalName, LastLogonDate, Modified
$orginal=[console]::ForegroundColor
if ( $table.LastLogonDate -gt $table.Modified) {
Write-Host -ForegroundColor Yellow "Warning! - Put info here!"
[console]::ForegroundColor = "Red"
$table
[console]::ForegroundColor = $orginal
} else {
$table
}