I have this Powershell script that returns MySql query results in email.
The problem is with the required data it also prints some not rquired columns like 'RowError RowState Table ItemArray HasErrors'
Following is the code snippet -
$subject = "Release report - bug status"
$body = $DataSet.Tables[0] | convertto-html | out-string ;
Send-MailMessage -smtpserver $smtpserver -from $from -to $to -subject $subject -body $body -bodyashtml -priority High
How to get rid of those columns?
Pls help.
You should be able to simply select the data from your table that you do want when defining $body
.
$body = $DataSet.Tables[0] | Select bug_id,Status,Resolution,Summary,Deadline | convertto-html | out-string
Or, you can select everything, and then specify what you want to exclude:
$body = $DataSet.Tables[0] | Select * -ExcludeProperty RowError, RowState, Table, ItemArray, HasErrors | convertto-html | out-string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With