Question

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 ?

Was it helpful?

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

OTHER TIPS

Could it be that you are not in the USA? I ask because I am in the UK and I find that the Get-WinEvent log benefits from this addition, or preamble:

[System.Threading.Thread]::CurrentThread.CurrentCulture = `
New-Object "System.Globalization.CultureInfo" "en-US"

You could use the export-csv class. This way you can open the table in Excel.

http://technet.microsoft.com/en-us/library/ee176825.aspx

Try the -ExpandProperty option. See this Technet link

Rather than using the append operator, try this:

... | Out-File G:\Sysadmin\FDMmonitor\Error.txt -Width 200

You can make the output width as wide as you need it with the -Width parameter.

Sometimes it still sends ellipsis even if you have a massive out-file -width further down the pipeline. In those cases you can use the Format-Table with the -Wrap and -AutoSize parameters to prevent truncation prior to output.

Format-Table -Wrap -AutoSize
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top