In Below Script I am able to get "disksizerequired" number in red by below script but I want that whole Cell to be red.
Please let me know how to do it
-----
# HTML code to format output
$b = "<style>"
$b = $b + "BODY{background-color:white;}"
$b = $b + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$b = $b + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$b = $b + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
$b = $b + "</style>"
# ***************************************************************************
# ***************************************************************************
# Variable initializing to send mail
$TXTFile = "C:\Abhishek\test\test231.html"
$SMTPServer = "mapintmail.lab.com"
$emailFrom = "Abhishek.Gupta@lab.com"
$emailTo = "abhi@lab.com"
$subject = "Sharepoint Farms Content databases Report"
$emailBody = "Dailyreport on Sharepoint Farms Content databases"
#*****************************************************************************
$encrypted ="01000000d08c9ddf0115d1118c7a00c04fc297eb0100000097606a1d1a7321488a23f2056c613f690000000002000000000003660000c000000010000000ebf48a9bd08c88a4de367597a1b86b390000000004800000a0000000100000006fa6c5ca0af8ad180e19cc6e5a42765e200000009a2551a74c5da425a1fa63705d1d7469fa0bb94409bf9a43ba951ee5c64d7ff614000000c9c659511fda53078b9f2e00f3b673349962affa"
$usser1 = "lab\abhi"
$usser2 = "labb\abhi"
$password = ConvertTo-SecureString -string $encrypted
$cred1 = new-object -typename System.Management.Automation.PSCredential -argumentlist $usser1,$password
$cred2 = new-object -typename System.Management.Automation.PSCredential -argumentlist $usser2,$password
#********************************************************************************
# Creating PSSession and Loading Snapin
$s1 = New-PSSession -Authentication CredSSP -Credential $cred1 -ComputerName LROSHRPTL01
$s2 = New-PSSession -Authentication CredSSP -Credential $cred2 -ComputerName LROSHRPTL03
Invoke-Command -Session $s1 -ScriptBlock {Add-PSSnapin Microsoft.SharePoint.PowerShell}
$f1 = Invoke-Command -Session $s1 -ScriptBlock {Get-SPWebApplication | Get-SPContentDatabase}
$g1 = $f1 | Select-Object DisplayName,WebApplication,disksizerequired,CurrentSiteCount,WarningSiteCount,MaximumSiteCount | ConvertTo-Html -Fragment DisplayName,WebApplication,CurrentSiteCount,WarningSiteCount,MaximumSiteCount,@{label="disksizerequired";expression={
if($_.disksizerequired -gt 1024*1204*1024)
{"#font"+$_.disksizerequired+"font#"}
else
{$_.disksizerequired}
}}
$g1 = $g1 -replace "#font","<font color='red'>"
$g1 = $g1 -replace "font#","</font>"
Invoke-Command -Session $s2 -ScriptBlock {Add-PSSnapin Microsoft.SharePoint.PowerShell}
$f2 = Invoke-Command -Session $s2 -ScriptBlock {Get-SPWebApplication | Get-SPContentDatabase}
$g2 = $f2 | Select-Object DisplayName,WebApplication,disksizerequired,CurrentSiteCount,WarningSiteCount,MaximumSiteCount | ConvertTo-Html -Fragment DisplayName,WebApplication,CurrentSiteCount,WarningSiteCount,MaximumSiteCount,@{label="disksizerequired";expression={
if($_.disksizerequired -gt 1024*1024*1024)
{"#font"+$_.disksizerequired+"font#"}
else
{$_.disksizerequired}
}}
$g2 = $g2 -replace "#font","<font color='red'>"
$g2 = $g2 -replace "font#","</font>"
ConvertTo-HTML -head $b -Body "<h1>$(Get-Date) Sharepoint Farm Database Content DB Report</h1> <br /> <h2>SharePoint_Config_UAT2010 $g1 SharePoint_Config_Intranet2010 $g2</h2>" | Out-File C:\Abhishek\test\test231.html
Invoke-Expression C:\Abhishek\test\test231.html
# Code to Send Mail
Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody -Attachment $TXTFile