[cmdletbinding()]
param
(
[Parameter(Position=0,ValuefromPipeline=$true)]
[string[]$ComputerName = $env:COMPUTERNAME
)
cluster node /status
If ($? -eq "True") {
$cluster = cluster node /status
$a = @'
<style type='text/css'> .nxn-ret-table{width:100%; border-collapse:collapse; font-family: Arial;} /* Define the background color for all the ODD background rows */ .nxn-ret-table tr:nth-child(odd){ background: #DAE0E1;} /* Define the background color for all the EVEN background rows */ .nxn-ret-table tr:nth-child(even){background: #f7f7f7; } pre { font-family: Arial; overflow: auto;} </style>
'@
$cluster | ConvertTo-Html -As List -Head $a -body "<H2>Cluster Status</H2>" | Out-File -FilePath C:\tmp\user.txt
Get-Content 'C:\tmp\user.txt' | Foreach-Object {$_ -replace '<table>', ("<table class='nxn-ret-table'>")} | Foreach-Object {$_ -replace '^<html.*$', ("<html>")} | Set-Content 'C:\tmp\user1.txt'
cat C:\tmp\user1.txt
}
else {Write-Host "<html><h1>Cluster is not configured on $ComputerName</h1></html>"}
when i run the above script .,output comes like
Node Node ID Status
-------------- ------- ---------------------
WSOMQAVDCI02 1 Up
wsomqavdci01 2 Up
But when trying to get the output in HTML.it does not work.
Can you please help in getting the out in HTML format
Open in new window