Search code examples
powershellpowershell-2.0event-viewer

Issue with Eventviewer log


Using below:

$pattern = 'Unable to create Load Balance Manager object!'
$events = Get-WinEvent -ea SilentlyContinue `
-ProviderName "Hyperion Financial Data Quality Management - Task Manager Service"|
Where-Object { $_.TimeCreated -gt [datetime]::now.AddMinutes(-15) -and $_.Message -match $pattern }
$events   >> G:\Sysadmin\FDMmonitor\Error.txt  

I'm getting Error.txt as below:

TimeCreated         ProviderName                         Id Message            
-----------         ------------                         -- -------            
1/24/2014 11:41:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:41:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:41:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:40:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:39:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:39:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:39:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:39:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:38:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:37:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:37:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:37:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:36:... Hyperion Financi...                   0 Unable to create...
1/24/2014 11:36:... Hyperion Financi...                   0 Unable to create...

I'm not getting, why TimeCreated, ProviderName and Message are not coming with full text ?

What I need to change in my code to get some more text for these columns ?


Solution

  • If you want to get the results as you see them on the screen without anything shortened, you might try changing your code like this:

     $events = Get-WinEvent -ea SilentlyContinue `
    -ProviderName "Hyperion Financial Data Quality Management - Task Manager Service"|
    Where-Object { $_.TimeCreated -gt [datetime]::now.AddMinutes(-15) -and $_.Message -match $pattern }
    $events |format-table -AutoSize |out-file -append -encoding Ascii G:\Sysadmin\FDMmonitor\Error.txt -width 300