This question is an exact duplicate of:
I'm trying to understand why some of the output from some of my ConvertTo-HTML commands are stripping the customised title of my PSObject output.
Here is the simple function:-
function get-WSUSInfo {
$wsus = Get-WsusUpdate -Classification All -Approval Unapproved -Status Needed
$props = @{'WSUS Updates Required for Approval'=$wsus.Count;
}
$obj = New-Object -TypeName PSObject -Property $props
Write-Output $obj
}
From Write-Output = $obj I get the following desired output:-
WSUS Updates Required for Approval 3
From $obj | ConvertTo-HTML I get the following:-
PS C:Windowssystem32> get-WSUSInfo | ConvertTo-Html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup><col/></colgroup>
<tr><th>*</th></tr>
<tr><td>3</td></tr>
</table>
</body></html>
I have used the same process throughout the entire PowerShell script and everything works as desired, however for this function the title is replaced with "*" & I can't work out why.
Thanks in advance for any help.
Aucun commentaire:
Enregistrer un commentaire