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