Member_2_6492660_1
asked on
Powershell Event Error Details
I have over 100 Windows servers from Windows 2003 to Windows 2012
We need to review the Event logs and a daily basis. We must use event viewer review the application and system logs.
This takes a while to expand the event log using MMC or Server Manager views.
I be playing around with Powershell scripts to handle this which is faster
So I use this command which lists the application Warnings Only from the last twenty four hours.
I use Level=2 for Errors also do this for both the application and system event logs.
This outputs see below and that is ok
get-winevent -FilterHashTable @{LogName='Application'; Level=3; StartTime=(get-date).addho urs(-24)}
TimeCreated ProviderName Id Message
----------- ------------ -- -------
10/2/2015 12:09:26 PM Microsoft-Windows-Certific ... 64 Certificate for local syst...
10/2/2015 4:09:25 AM Microsoft-Windows-Certific ... 64 Certificate for local syst...
10/1/2015 8:09:24 PM Microsoft-Windows-Certific ... 64 Certificate for local syst...
This looks good
My question is how do I display the details of Event Id 64 using power shell
I only want to view the last occurrence I have only been able to get a long list of all instances.
Our management here is not keen on elaborate scripts they like us to use command line so we remember the commands
Every day the events will be different so maybe a short script where I can just add the event id as input would be nice.
Thoughts
Thanks
We need to review the Event logs and a daily basis. We must use event viewer review the application and system logs.
This takes a while to expand the event log using MMC or Server Manager views.
I be playing around with Powershell scripts to handle this which is faster
So I use this command which lists the application Warnings Only from the last twenty four hours.
I use Level=2 for Errors also do this for both the application and system event logs.
This outputs see below and that is ok
get-winevent -FilterHashTable @{LogName='Application'; Level=3; StartTime=(get-date).addho
TimeCreated ProviderName Id Message
----------- ------------ -- -------
10/2/2015 12:09:26 PM Microsoft-Windows-Certific
10/2/2015 4:09:25 AM Microsoft-Windows-Certific
10/1/2015 8:09:24 PM Microsoft-Windows-Certific
This looks good
My question is how do I display the details of Event Id 64 using power shell
I only want to view the last occurrence I have only been able to get a long list of all instances.
Our management here is not keen on elaborate scripts they like us to use command line so we remember the commands
Every day the events will be different so maybe a short script where I can just add the event id as input would be nice.
Thoughts
Thanks
ASKER
footech
thanks for responding
this is what I mean by full details
Log Name: Application
Source: Microsoft-SharePoint Products-SharePoint Server Search
Date: 9/6/2015 5:56:41 AM
Event ID: 14
Task Category: Gatherer
Level: Warning
Keywords:
User: xxx\spservices
Computer: SERV013.FQDN.com
Description:
The start address http://sharepointtgcs.com cannot be crawled.
Context: Application 'Search_Service_Applicatio n', Catalog 'Portal_Content'
Details:
An unrecognized HTTP response was received when attempting to crawl this item. Verify whether the item can be accessed using your browser. (0x80041204)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-SharePoint Products-SharePoint Server Search" Guid="{C8263AFE-83A5-448C- 878C-1E5F5 D1C4252}" />
<EventID>14</EventID>
<Version>14</Version>
<Level>3</Level>
<Task>137</Task>
<Opcode>0</Opcode>
<Keywords>0x40000000000000 00</Keywor ds>
<TimeCreated SystemTime="2015-09-06T09: 56:41.8512 64900Z" />
<EventRecordID>57936</Even tRecordID>
<Correlation />
<Execution ProcessID="1512" ThreadID="9160" />
<Channel>Application</Chan nel>
<Computer>SERV013.FQDN.com </Computer >
<Security UserID="S-1-5-21-305458857 1-13414595 84-7841283 02-4607" />
</System>
<EventData>
<Data Name="string0">http://sharepointtgcs.com</Data>
<Data Name="string1">
Context: Application 'Search_Service_Applicatio n', Catalog 'Portal_Content'
Details:
An unrecognized HTTP response was received when attempting to crawl this item. Verify whether the item can be accessed using your browser. (0x80041204)</Data>
</EventData>
</Event>
so when I get the list of event I would like to run another command to show the entire event message
do you have an example to display the event ?
thanks for responding
this is what I mean by full details
Log Name: Application
Source: Microsoft-SharePoint Products-SharePoint Server Search
Date: 9/6/2015 5:56:41 AM
Event ID: 14
Task Category: Gatherer
Level: Warning
Keywords:
User: xxx\spservices
Computer: SERV013.FQDN.com
Description:
The start address http://sharepointtgcs.com cannot be crawled.
Context: Application 'Search_Service_Applicatio
Details:
An unrecognized HTTP response was received when attempting to crawl this item. Verify whether the item can be accessed using your browser. (0x80041204)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-SharePoint
<EventID>14</EventID>
<Version>14</Version>
<Level>3</Level>
<Task>137</Task>
<Opcode>0</Opcode>
<Keywords>0x40000000000000
<TimeCreated SystemTime="2015-09-06T09:
<EventRecordID>57936</Even
<Correlation />
<Execution ProcessID="1512" ThreadID="9160" />
<Channel>Application</Chan
<Computer>SERV013.FQDN.com
<Security UserID="S-1-5-21-305458857
</System>
<EventData>
<Data Name="string0">http://sharepointtgcs.com</Data>
<Data Name="string1">
Context: Application 'Search_Service_Applicatio
Details:
An unrecognized HTTP response was received when attempting to crawl this item. Verify whether the item can be accessed using your browser. (0x80041204)</Data>
</EventData>
</Event>
so when I get the list of event I would like to run another command to show the entire event message
do you have an example to display the event ?
ASKER
Footech
tried this
Get-WinEvent -FilterHashtable @{ LogName = "Application"; id = 1001; -maxevents=1}
At line:1 char:68
+ ... nEvent -FilterHashtable @{ LogName = "Application"; id = 1001; -maxev ...
+ ~
The hash literal was incomplete.
At line:1 char:82
+ ... -FilterHashtable @{ LogName = "Application"; id = 1001; -maxevents=1}
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : IncompleteHashLiteral
tried this
Get-WinEvent -FilterHashtable @{ LogName = "Application"; id = 1001; -maxevents=1}
At line:1 char:68
+ ... nEvent -FilterHashtable @{ LogName = "Application"; id = 1001; -maxev ...
+ ~
The hash literal was incomplete.
At line:1 char:82
+ ... -FilterHashtable @{ LogName = "Application"; id = 1001; -maxevents=1}
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : IncompleteHashLiteral
So you want to display all events using the table format, e.g.
If so, for that last display, you'd either have to re-do the query, or have saved the previous results so that you can then just display one. There's no exact equivalent to the view you get in Event Viewer, basically you'd just want to show all properties (think Format-List *).
The -maxevents parameter is not part of the hashtable.
TimeCreated ProviderName Id Message
----------- ------------ -- -------
10/2/2015 12:09:26 PM Microsoft-Windows-Certific... 64 Certificate for local syst...
10/2/2015 4:09:25 AM Microsoft-Windows-Certific... 64 Certificate for local syst...
10/1/2015 8:09:24 PM Microsoft-Windows-Certific... 64 Certificate for local syst...
and then you want to display everything for just one of those events?If so, for that last display, you'd either have to re-do the query, or have saved the previous results so that you can then just display one. There's no exact equivalent to the view you get in Event Viewer, basically you'd just want to show all properties (think Format-List *).
The -maxevents parameter is not part of the hashtable.
ASKER
Confused now
Is there a way to display a single event error? And only the last occurrence?
Example please?
Is there a way to display a single event error? And only the last occurrence?
Example please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
FooTech
That worked and is what I was looking for
Now I am off to setting up the script to except input so I can display any event Id I come across
If I have any issues I ll post another one
Thanks again
That worked and is what I was looking for
Now I am off to setting up the script to except input so I can display any event Id I come across
If I have any issues I ll post another one
Thanks again
If you just want the message, use Select-Object.
If you only want event ID 64, include ID in your filterhashtable.
If you want to limit the number of events retrieved, use the -MaxEvents parameter of Get-WinEvent.