Convert to HTML Error

Welcome Forums General PowerShell Q&A Convert to HTML Error

This topic contains 2 replies, has 2 voices, and was last updated by

1 year, 3 months ago.

  • Author
  • #84517

    Points: 2
    Rank: Member

    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 {
    $os = Get-WmiObject -class Win32_OperatingSystem -ComputerName $ComputerName
    $props = @{'OSVersion'=$os.version
    New-Object -TypeName PSObject -Property $props

    $params = @{ 'As'='List';
    $html_os = get-infoOS -ComputerName $ComputerName |ConvertTo-EnhancedHTMLFragment @params

    $params2 = @{ 'Title'='System 1';
    'Precontent'='H2>System 32 system';

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

  • #84524

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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.

  • #84658

    Points: 2
    Rank: Member

    same error. wonder is the syntas

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

    $computer = "localhost"

    function Get-InfoCompSystem {
    $cs = Get-WmiObject -class Win32_ComputerSystem -ComputerName $ComputerName
    $props = @{'Model'=$cs.model;
    'RAM (GB)'="{0:N2}" -f ($cs.totalphysicalmemory / 1GB);
    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

The topic ‘Convert to HTML Error’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort