title: Append Powershell Variable result to Event Log
body: <p>I came across this very useful and simple powershell script to write an event log.
  My issue is that I want to write the result as the event message. I get something that looks similar to the $result variable but not exactly as printed on the screen. Can someone point me to the correct direction?</p>
  
  <pre><code>begin {
      $EventHashInformation = @{
          LogName   = 'Application'
          Source    = 'My Script'
          EventId   = 2783
          EntryType = 'Information'
      }
      $EventHashWarning     = @{
          LogName   = 'Application'
          Source    = 'My Script'
          EventId   = 2784
          EntryType = 'Warning'   
      }
    Write-EventLog @EventHashInformation -Message 'Script started'
  }
  
  process {
      try {
          $result = Get-CimInstance -ClassName Win32_Bios -ErrorAction Stop
          Write-EventLog @EventHashInformation -Message $result 
      } catch {
          Write-EventLog @EventHashWarning -Message 'Error occurred while  queried Win32_Bios'
      }
  }
  
  end {
      Write-EventLog @EventHashInformation -Message 'Script finished'
  }
  </code></pre>
  
  <p>This is what I get in the event log</p>
  
  <pre><code>Win32_BIOS: BIOS Date: 05/23/12 17:15:53  Ver: 09.00.06 (Name = "BIOS Date: 05/23/12 17:15:53  Ver: 09.0..., SoftwareElementID = "BIOS Date: 05/23/12 17:15:53  Ver: 09.0..., SoftwareElementState = 3, TargetOperatingSystem = 0, Version = "VRTUAL - 5001223") : %2
  </code></pre>
  
  <p>This is what I need (screen print in powershell)</p>
  
  <pre><code>SMBIOSBIOSVersion : 60KT38AUS
  Manufacturer      : LENOVO
  Name              : Lenovo ThinkStation BIOS Ver 60KT38.0
  SerialNumber      : MJWNY54
  Version           : LENOVO - 60400d0
  </code></pre>