title: converto-html system.object to system.string required by parameter PostContent
body: <p>I am trying to execute a series of steps and create an HTML file. Below is the code:</p>
  
  <pre><code>$bkpstat = @()
  
  $a = Get-Date
  $b = $a.AddDays(-1)
  $b = $b.ToShortDateString();
  $StartTime = "10:00:00 PM"
  $EndTime = "11:00:00 PM"
  $before = $b + " " + $StartTime
  $after = $b + " " + $EndTime
  $before = [datetime]$before
  $after = [datetime]$after
  
  
  $sms_svc = "SMS Agent Host","SMS_EXECUTIVE","SMS_SITE_COMPONENT_MANAGER","SMS_SITE_VSS_WRITER","SMS_REPORTING_POINT","SMS_SERVER_LOCATOR_POINT"
  $smsdb_svc = "SMS Agent Host","SMS_SITE_SQL_BACKUP_WDSMS01"
  
  $style = "&lt;style&gt;$(get-content C:\Temp\Rajiv\style.css)&lt;/style&gt;"
  
  $bkpsys = New-Object PSObject
  $bkpsys | Add-Member -type NoteProperty -name SiteCode -value 000
  $bkpstat += $bkpsys
  
  if(Test-Connection WDSMS01 -Count 3 -BufferSize 3 -Quiet)
  {
      Write-Host "SMS01 is available. Checking service status"
  
      $cmsvc_000 = Get-Service $sms_svc -ComputerName SMS01 | Convertto-HTML -Property Name, Status -PreContent "&lt;h2&gt;Service Status for SMS01 &lt;/h2&gt;" | Out-String
  
      Write-Host "Checking Site Server backup for 000"
  
      $smsbkp_000 = Get-EventLog -ComputerName SMS01 -LogName Application -After $after -Before $before -Source "SMS Server" | ?{$_.EventID -eq 6833} | Select MachineName, Message
      if ($smsbkp_000)
      {
          $bkpsys | Add-Member -type NoteProperty -Name SiteServer -Value "Success"
      }
      else
      {
          $bkpsys | Add-Member -type NoteProperty -Name SiteServer -Value "Failed"
      }
  
  
  }
  else
  {
      Write-Host "Server SMS01 is not reachable"
      $bkpsys | Add-Member -type NoteProperty -name SiteServer -value "Not Reachable"
  }
  
  if(Test-Connection SCCMSQL01 -Count 3 -BufferSize 3 -Quiet)
  {
      Write-Host "SCCMSQL01 is available. Checking service status"
  
      $cmdbsvc_000 = Get-Service $smsdb_svc -ComputerName SCCMSQL01 | Convertto-HTML -Property Name, Status -PreContent "&lt;h2&gt;Service Status for SCCMSQL01 &lt;/h2&gt;" | Out-String
  
      Write-Host "Checking Database backup for SMS_000"
      $sqlbkp_000 = Get-EventLog -ComputerName SCCMSQL01 -LogName Application -After $after -Before $before -Source "MSSQLSERVER" | ?{$_.EventID -eq 18264} | Select MachineName, Message
      if ($sqlbkp_000)
      {
          $bkpsys | Add-Member -type NoteProperty -name Database -value "Success"
      }
      else
      {
          $bkpsys | Add-Member -type NoteProperty -Name Database -Value "Failed"
      }
  
  
  }
  else
  {
      Write-Host "Server SCCMSQL01 is not reachable"
      $bkpsys | Add-Member -type NoteProperty -name Database -value "Not Reachable"
  }
  $bkpstat
  $params = @{'Head'="&lt;title&gt;Report for ConfigMgr Site 000&lt;/title&gt;$style";
      'PreContent'="&lt;h1&gt;Daily Check&lt;/h1&gt;";
      'PostContent'=$cmsvc_000, $cmdbsvc_000, $bkpstat} 
  
   Convertto-HTML @params | Out-File C:\Temp\Rajiv\Site_000.html
  </code></pre>
  
  <p>The error msg that I get is:</p>
  
  <p>ConvertTo-Html : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'PostContent'. Spec
  ified method is not supported.
  At C:\temp\rajiv\DailyCheck_000.ps1:88 char:16
  +  Convertto-HTML &lt;&lt;&lt;&lt;  @params | Out-File C:\Temp\Rajiv\Site_000.html
      + CategoryInfo          : InvalidArgument: (:) [ConvertTo-Html], ParameterBindingException
      + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.ConvertToHtmlCommand</p>
  
  <p>I have tried using Out-String, with and with out Convertto-HTML for $bkp, in vain. Can some one please help. </p>
  
  <p>Thanks!</p>