Question

Trying to figure out how to convert to HTML multiple service checks:

I have this script:

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

Is this possible?

Was it helpful?

Solution

May be you can do something like this -

$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

NB: Replace $Event and $Process with your service cmdlets.

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top