Ok, this may have been answered, but I\'m new and trying to learn, so I guess I\'m not \"getting\" it. I have a variable that contains a table of information (I got it from
I use like this:
Import-Module C:\dbatools\dbatools.psd1
$HostName = Get-WMIObject Win32_ComputerSystem | Select-Object -ExpandProperty name
$DiskResult = Get-DbaDiskSpace -ComputerName $HostName | Sort-Object $_.FreeInGB | Out-DbaDataTable
# Create column headers of Table1
$HtmlTable1 = "
ComputerName
Name
Label
SizeInGB
FreeInGB
PercentFree
"
# Insert data into Table1
foreach ($row in $DiskResult)
{
$HtmlTable1 += "
" + $row.ComputerName + "
" + $row.Name + "
" + $row.Label + "
" + $row.SizeInGB + "
" + $row.FreeInGB + "
" + $row.PercentFree + "
"
}
$HtmlTable1 += "
"
# Send Mail Inputs
$smtpserver = "smtp.domain.com"
$from = "Powershell Mail <" + $HostName + "@domain.com>"
$to = "", ""
$cc = "" , ""
$subject = "Disk Check for SQL Server"
$body = "Disk info for SQL Server like below:
" + $HtmlTable1
Send-MailMessage -smtpserver $smtpserver -from $from -to $to -cc $cc -subject $subject -body $body -bodyashtml