gpt4 book ai didi

powershell - 去掉使用convert-tohtml时出现的powershell Mysql查询结果中不需要的列

转载 作者:行者123 更新时间:2023-12-03 14:15:40 27 4
gpt4 key购买 nike

我有这个 Powershell 脚本,它在电子邮件中返回 MySql 查询结果。

问题在于所需的数据,它还会打印一些不需要的列,例如“RowError RowState Table ItemArray HasErrors”

enter image description here

以下是代码片段 -

$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

如何摆脱那些列?

请帮忙。

最佳答案

在定义 $body 时,您应该能够简单地从表中选择您想要的数据。 .

$body = $DataSet.Tables[0] | Select bug_id,Status,Resolution,Summary,Deadline | convertto-html | out-string

或者,您可以选择所有内容,然后指定要排除的内容:
$body = $DataSet.Tables[0] | Select * -ExcludeProperty RowError, RowState, Table, ItemArray, HasErrors | convertto-html | out-string

关于powershell - 去掉使用convert-tohtml时出现的powershell Mysql查询结果中不需要的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28182610/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com