3

试图弄清楚如何转换为 HTML 多个服务检查:

我有这个脚本:

Get-service -Computername SERVER1 -Name *SERVICE1* | ConvertTo-Html -Body "<H2>Service 1 Check</H2> " -Property Name,Status 
Get-Service  -Computername SERVER2 -name *SERVICE2* | ConvertTo-Html -Body "<br><H2>Service 2 Check</H2> " -Property Name,Status | Out-File  c:\servicecheck.htm

这可能吗?

4

1 回答 1

9

也许你可以做这样的事情 -

$Event = Get-EventLog -LogName Security -newest 100 | ConvertTo-HTML -Fragment 
$Process = Get-Process | ConvertTo-HTML -Fragment 
ConvertTo-HTML -Body "$Event $Process" -Title "Status Report" |  Out-File c:\StatusReport.html

注意:替换$Event and $Process为您的服务 cmdlet。

-Fragment [<SwitchParameter>] Generates only an HTML table. The HTML, HEAD, TITLE, and BODY tags are omitted.

参考 - http://technet.microsoft.com/en-us/magazine/hh127059.aspx

于 2013-05-14T15:22:01.433 回答