Coloring a particular a Row result with PowerShell

cls
$services=Get-Service -name '*sql*'
$services|
ForEach-Object{
$Know=$_
if($_.Status -eq "Running")
{

 Write-Host   $Know.Status, $Know.Name,$Know.DisplayName -foregroundcolor Green -Separator ' : '
}
else
{
Write-Host    $Know.Status, $Know.Name, $Know.DisplayName -foregroundcolor Red -Separator ' : '
}
}

Comments

Popular posts from this blog

Always On FailOver Events

SSAS Cube or Database backup with Powershell command "Backup-AsDatabase"

The transaction log for database is full due to 'OLDEST_PAGE'