converting to enhancedhtml

This topic contains 2 replies, has 2 voices, and was last updated by  Helder Guzman 1 year, 11 months ago.

  • Author
  • #30740

    Helder Guzman

    Hi I just run into a little problem.

    I'm trying to convert some data into html using the enhancedHtml method.

    $process = get-process

    $process |convertto-EnhancedHTML and I get this error

    ConvertTo-EnhancedHTML : Parameter set cannot be resolved using the specified named parameters.
    At line:1 char:5
    + $c |ConvertTo-EnhancedHTML
    + ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [ConvertTo-EnhancedHTML], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,ConvertTo-EnhancedHTML

    very simple but I'm getting the error and can find where is the error or how to fix it?

    can somebody help

  • #30741

    Don Jones

    I wrote ConvertTo-EnhancedHTML as part of "Creating HTML Reports in PowerShell," which is on our Resources > eBooks menu option here. You can't run the command with zero parameters – I suggest either reviewing its help, or reviewing the book's later chapters, for information on how to use it. It isn't a "simple" command – if you just want basic HTML, use the native ConvertTo-HTML.

    The error, generically, will happen whenever you run a command that has multiple parameter sets, and PowerShell can't tell (based on the parameters you've used) which one you're attempting to run.

  • #30745

    Helder Guzman

    Here is the complete script

    $servername = '' #Read-host "Server DNS Name ie."
    $cred = Get-Credential -Message "User Info for Domain Server is in" -UserName "QA-ENT\RU413628"

    $fileHtml = "C:\Scripts\vm.html"

    function Get-HGVMSystemInfo{


    ( [string]$ComputerName)

    $os = Get-WmiObject -Class win32_operatingsystem -ComputerName $ComputerName -Credential $cred
    $cs = Get-WmiObject -Class win32_computersystem -ComputerName $ComputerName -Credential $cred
    $network = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $ComputerName -Credential $cred -Filter "IpEnabled = 'True' " |
    select -ExpandProperty IPAddress |out-string

    $props = @{'ServerName' = $ComputerName;
    'OS' = $os.caption;
    'ServicePack' = $os.servicepackmajorversion;
    'PhysicalMemory' = $cs.totalphysicalmemory /1gb -as [int];
    'Domain' = $cs.domain ;
    'IPAddress' = $network }

    $obj = New-Object -TypeName psobject -Property $props

    Write-Output $obj


    $systemInfo_Frag = Get-HGVMSystemInfo -ComputerName $servername |
    ConvertTo-EnhancedHTMLFragment -PreContent "System Info" `
    -TableCssClass 'SystemInfo' `
    -As List `
    -Properties ServerName, OS, ServicePack, PhysicalMemory,Domain, IPAddress |Out-String

    ConvertTo-EnhancedHTML -HTMLFragments $systemInfo_Frag -PreContent "Windows SIC Verification$servernameThis report was run on: $(get-date)" |out-file $fileHtml

You must be logged in to reply to this topic.