Author Posts

October 13, 2015 at 10:31 am

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

October 13, 2015 at 10:36 am

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.

October 13, 2015 at 11:08 am

Here is the complete script

$servername = 'LQVWA00A0002.ent.wfb.bank.qa' #Read-host "Server DNS Name ie. wfcp5777i.wf.local"
$cred = Get-Credential -Message "User Info for Domain Server is in" -UserName "QA-ENT\RU413628"

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

function Get-HGVMSystemInfo{

[cmdletbinding()]

param
( [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