Convert to HTML Error

Hi I’m trying to test a function and pass it to the convertto-enhancedHTML and I get an error.

ConvertTo-EnhancedHTML : Parameter set cannot be resolved using the specified named parameters.
At line:25 char:14

here is the code

$filepath1 = “C:\Users\U611806\Desktop\MyFiles\PDFPowerShell\helderhtml.html”

$ComputerName = “localhost”

function Get-InfoOS {
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)][string]$ComputerName
)
$os = Get-WmiObject -class Win32_OperatingSystem -ComputerName $ComputerName
$props = @{‘OSVersion’=$os.version
‘SPVersion’=$os.servicepackmajorversion;
‘OSBuild’=$os.buildnumber}
New-Object -TypeName PSObject -Property $props
}

$params = @{ ‘As’=‘List’;
‘Precontent’=‘H2>OS’}
$html_os = get-infoOS -ComputerName $ComputerName |ConvertTo-EnhancedHTMLFragment @params

$params2 = @{ ‘Title’=‘System 1’;
‘Precontent’=‘H2>System 32 system’;
‘HTMLFragments’=@($html_os)}

         ConvertTo-EnhancedHTML @params2   | Out-File -FilePath $filepath1

Try running your fragment through Out-String to start with. But the error usually means you haven’t provided enough parameters for the binding to figure out which parameter set you want to use.

same error. wonder is the syntas

$filepath = “C:\Users\U611806\Desktop\MyFiles\PDFPowerShell\html2.html”

$computer = “localhost”

function Get-InfoCompSystem {
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)][string]$ComputerName
)
$cs = Get-WmiObject -class Win32_ComputerSystem -ComputerName $ComputerName
$props = @{‘Model’=$cs.model;
‘Manufacturer’=$cs.manufacturer;
‘RAM (GB)’=“{0:N2}” -f ($cs.totalphysicalmemory / 1GB);
‘Sockets’=$cs.numberofprocessors;
‘Cores’=$cs.numberoflogicalprocessors}
New-Object -TypeName PSObject -Property $props
}

$params = @{‘As’=‘List’;
‘PreContent’=‘Computer System’}

$html_cs = Get-InfoCompSystem -ComputerName $computer |
ConvertTo-EnhancedHTMLFragment @params|Out-String

ConvertTo-EnhancedHTML -HTMLFragments $html_cs |Out-File $filepath