title: Powershell Get-WinEvent Truncates Message
body: <p>I have the following Powershell code that counts the number of errors occurring per Provider, based on Error ID and Message.  What I am after is getting the count of each unique message per computer, log, provider, id and level. </p>
  
  <p>However the issue that I'm having is that when I export this information to .csv the event message is being truncated.  Or rather, I'm not able to quite grasp what I need to do to get the entire event message.</p>
  
  <p>Here is the code that grabs the event logs and exports it to .csv.</p>
  
  <pre><code>$computername = 'mycomputer'
  $logs = "application", "system"
  
  $info  = get-winevent -ComputerName $computername -FilterHashTable @{LogName=$logs; Level=1,2,3} | 
  sort MachineName,LogName,ProviderName,{$_.LevelDisplayName},ID | 
  Group MachineName, LogName, ProviderName, ID, {$_.LevelDisplayName}, Count, Message |
  select @{N="Computer";E={$_.name.split(',')[0]}},@{N="Log";E={$_.name.split(',')[1]}}, @{N="Provider";E={$_.name.split(',')[2]}}, @{N="Error ID";E={$_.name.split(',')[3]}},`
  @{N="Type";E={$_.name.split(',')[4]}}, count, @{N="Message";E={$_.name.split(',')[5 | 
  Export-Csv -notypeinformation -Path c:\Test\events.csv
  </code></pre>
  
  <p>If I comment out </p>
  
  <pre><code>#| Export-Csv -notypeinformation -Path c:\Test\events.csv
  </code></pre>
  
  <p>And output </p>
  
  <pre><code>$info
  </code></pre>
  
  <p>I see the complete message.  I also can see more of the message if I continue to expand the array indexes.  For example I get more of the message if I do this:</p>
  
  <pre><code>, @{N="Message1";E={$_.name.split(',')[6]}}, @{N="Message2";E={$_.name.split(',')[7]}}
  </code></pre>
  
  <p>What do I need to code correct to get the entire message out in the </p>
  
  <pre><code>@{N="Message";E={$_.name.split(',')[5]}} 
  </code></pre>
  
  <p>selection?</p>