{"id":3891,"date":"2009-06-11T03:58:00","date_gmt":"2009-06-11T03:58:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2009\/06\/11\/windows-event-log-in-powershell-part-ii\/"},"modified":"2019-02-18T13:12:34","modified_gmt":"2019-02-18T20:12:34","slug":"windows-event-log-in-powershell-part-ii","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/windows-event-log-in-powershell-part-ii\/","title":{"rendered":"Windows Event Log in PowerShell &#8211; Part II"},"content":{"rendered":"<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">In part&nbsp;1 of \u201c<\/font><a href=\"http:\/\/blogs.msdn.com\/powershell\/archive\/2009\/05\/21\/processing-event-logs-in-powershell.aspx\" target=\"_blank\"><span><font face=\"Calibri\">Event logs in Powershell<\/font><\/span><\/a><font face=\"Calibri\">\u201d we talked about differences between Get-EventLog and Get-WinEvent. In this second part we will dig deeper into Get-WinEvent. <\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Starting in Windows Vista, the <\/font><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa382610(VS.85).aspx\"><span><font face=\"Calibri\">Windows Event Log<\/font><\/span><\/a><font face=\"Calibri\"> was updated to provide a more powerful event model which allows for events to be easily categorized into logs and for event providers to be easily discovered.&nbsp; PowerShell V2 lets you search the Event Log for the data that&#8217;s interesting to you, making it easier than ever to mine events from the Event Log. The new Get-WinEvent cmdlet provides access to all event logs on the system, including the legacy Event Logs.<span>&nbsp; <\/span>Get-WinEvent cmdLet will be available on PowerShell V2 Running on Windows Vista and above (i.e. Windows Vista, Windows Vista SP1, Windows Server 2008, Windows 7 and Windows Server 2008 R2).<span>&nbsp; <\/span>Get-WinEvent replaces the existing Get-EventLog cmdlet on these systems.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><b><span lang=\"EN\"><font face=\"Calibri\">Getting Events from the Event Log<\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Getting events is easy with PowerShell. If I want to list all of the events in the system, I can run Get-WinEvent without any parameters:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\"><i><span lang=\"EN\">&gt; Get-WinEvent<\/span><\/i><span lang=\"EN\"><\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">The number of events can be excessively large, so be prepared to use \u2018Ctrl-C\u2019 to break out of it early. Since some logs are protected, you might see an error when running this command if you are not running PowerShell elevated as an Administrator.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Suppose you want to see the most recent 10 events which were logged. In PowerShell, I\u2019d make a small modification:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><i><span lang=\"EN\"><font face=\"Calibri\">&gt; Get-WinEvent -MaxEvents 10<\/font><\/span><\/i><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;The command above uses the default behavior to get events from every event log and uses the MaxEvents parameter to return only the most recent 10 events.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;If you wanted to see the events from a specific channel, such as the general \u201cApplication\u201d and \u201cSystem\u201d channels, simply specify which logs you want to get events from:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\"><i><span lang=\"EN\">&gt; Get-WinEvent Application, System -MaxEvents 10<\/span><\/i><span lang=\"EN\"><\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\"><b><span lang=\"EN\">Discovering Logs, Providers and Events<\/span><\/b><span lang=\"EN\"><\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Generally it is more interesting to find the specific events that you care about.&nbsp; For that, we can use wildcards to find event providers and logs which we&#8217;re interested in.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">For example, if we&#8217;re interested in what Windows Update has been doing on a particular machine, we can search for the Windows Update event provider:<\/font><\/span><\/p>\n<table class=\"MsoNormalTable\" border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<tbody>\n<tr>\n<td vAlign=\"top\" width=\"798\">\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\&gt; Get-WinEvent -ListProvider *update*<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>LogLinks<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8211;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">MCUpdate<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Media Center}<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Microsoft-Windows-WindowsUpdateClient<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{System, Microsoft-Windows-WindowsUpdateClient\/Operational}<\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Now that we know the name of the provider (Microsoft-Windows-WindowsUpdateClient), we can see the events that the provider has already logged to the Event Log:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><i><span lang=\"EN\"><font face=\"Calibri\">&gt; Get-WinEvent -ProviderName&nbsp; Microsoft-Windows-WindowsUpdateClient<\/font><\/span><\/i><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">In some cases, it is more interesting to know what events the provider can <i>potentially<\/i> log instead of what it already has logged.&nbsp; If we want to see the events that Windows Update can log in the future, we can take a deeper look at the provider: E.g to see the messages that will be logged with word \u201csuccess\u201d in the event message, we can use the following:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<table class=\"MsoNormalTable\" border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<tbody>\n<tr>\n<td vAlign=\"top\" width=\"798\">\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\&gt; $provider = Get-WinEvent -ListProvider<span>&nbsp; <\/span>Microsoft-Windows-WindowsUpdateClient<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\&gt; $provider.events | ? {$_.description -match &#8220;success&#8221;} | select id,description | ft -AutoSize<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Id<span>&nbsp;&nbsp; <\/span>Description<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&#8212;<span>&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;-<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">19<span>&nbsp;&nbsp; <\/span>Installation Successful: Windows successfully installed the following update: %1<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">23<span>&nbsp;&nbsp; <\/span>Uninstallation Successful: Windows successfully uninstalled the following update: %1<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">36<span>&nbsp;&nbsp; <\/span>The Windows Update Client Core component was successfully updated from version %1 to version %2.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">37<span>&nbsp;&nbsp; <\/span>The Windows Update Client Auxillary was successfully updated from version %1 to version %2.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\&gt; $provider.events | ? {$_.description -match &#8220;success&#8221;} | select -First 1<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Id<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: 19<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Version<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: 0<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">LogLink<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: System.Diagnostics.Eventing.Reader.EventLogLink<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Level<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: System.Diagnostics.Eventing.Reader.EventLevel<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Opcode<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: System.Diagnostics.Eventing.Reader.EventOpcode<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Task<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: System.Diagnostics.Eventing.Reader.EventTask<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Keywords<span>&nbsp;&nbsp;&nbsp; <\/span>: {, success, install}<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Template<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: &lt;template xmlns=&#8221;http:\/\/schemas.microsoft.com\/win\/2004\/08\/events&#8221;&gt;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&lt;data name=&#8221;updateTitle&#8221; inType=&#8221;win:UnicodeString&#8221; outType=&#8221;xs:string&#8221;\/&gt;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&lt;data name=&#8221;updateGuid&#8221; inType=&#8221;win:GUID&#8221; outType=&#8221;xs:GUID&#8221;\/&gt;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&lt;data name=&#8221;updateRevisionNumber&#8221; inType=&#8221;win:UInt32&#8243; outType=&#8221;xs:unsignedInt&#8221;\/&gt;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&lt;\/template&gt;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Description : Installation Successful: Windows successfully installed the following update: %1<\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">From this event description I can tell that the event logs the title of the update in the &#8220;updateTitle&#8221; field of the event Template, which will let me write a script that reports back the installed updates.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp; <\/font><\/span><\/p>\n<p class=\"MsoNormal\"><b><span lang=\"EN\"><font face=\"Calibri\">Filtering Events<\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">If I want to look at all of the updates that have been installed, I can simply filter them in PowerShell:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><i><span lang=\"EN\"><font face=\"Calibri\">&gt; Get-WinEvent -Provider Microsoft-Windows-WindowsUpdateClient | ? {$_.id -eq 19} | ft timestamp, message -auto<\/font><\/span><\/i><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">While using PowerShell to filter the events in our last example works well, Get-WinEvent provides even more powerful filtering which is done by the Event Log. Generally, you&#8217;ll want to use the Get-WinEvent FilterXPath or FilterHashTable parameters to reduce the number of events that you have to process in PowerShell. This is because the Event Log is very efficient at filtering events based on these queries.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">For example, to perform the same filtering as the previous example without using PowerShell to filter I can use a FilterHashTable:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><i><span lang=\"EN\"><font face=\"Calibri\">&gt; Get-WinEvent -FilterHashTable @{ProviderName=&#8221;Microsoft-Windows-WindowsUpdateClient&#8221;; ID=19} | ft timestamp, message -auto<\/font><\/span><\/i><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Take a look at Get-WinEvent help for more information about how to use the FilterHashTable parameter.&nbsp; It is very, very useful!<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><b><span lang=\"EN\"><font face=\"Calibri\">Working with Events<\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">An individual event carries much more information than just the timestamp, event ID, and a message string. Event Log events contain a wealth of information such as the level which indicates if the event was an error, warning, or simply informational.&nbsp; Events also carry payloads of data which are unique to each event which are described by their &lt;template&gt;.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Going back to our Windows Update example, if I wanted to just return the title of the update of each update installed, I could do so by pulling that data out of the event.&nbsp; I know from the event description (above) that the first property of the event is the title of the update (which is given by the event template).&nbsp; Knowing that, I can just pull out the single property and display it:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<table class=\"MsoNormalTable\" border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<tbody>\n<tr>\n<td vAlign=\"top\" width=\"798\">\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\&gt; Get-WinEvent -FilterHashTable @{ProviderName=&#8221;Microsoft-Windows-WindowsUpdateClient&#8221;; ID=19} | foreach {$_.properties[0]}<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Value<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&#8212;&#8211;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Definition Update for Windows Defender &#8211; KB915597 (Definition 1.59.789.0)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Intel Corporation driver update for Mobile Intel(R) 45 Express Chipset Family (Microsoft Corporation \u2026<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Test Update for Windows 7 Release Candidate for x64-based Systems (KB970424)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Update for Office Communicator 2007 R2 (KB 971083)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Definition Update for Windows Defender &#8211; KB915597 (Definition 1.59.659.0)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Definition Update for Windows Defender &#8211; KB915597 (Definition 1.59.458.0)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Test Update for Windows 7 Release Candidate for x64-based Systems (KB970421)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Test Update for Windows 7 Release Candidate for x64-based Systems (KB970423)<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Update for Internet Explorer 8 Compatibility View List for Windows 7 Release Candidate for x64-based Systems \u2026<\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;&nbsp; <\/font><\/span><\/p>\n<p class=\"MsoNormal\"><b><span lang=\"EN\"><font face=\"Calibri\">Events from Remote Machines<\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">The Get-WinEvent cmdlet can be used to get events from remote machines using the Event Log remote connection protocol.&nbsp; For example, if I want to get the most recent 100 events from the Application and System log from a remote machine:<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><i><span lang=\"EN\"><font face=\"Calibri\">&gt; Get-WinEvent -ComputerName machine.name.contoso.com -LogName Application, System -MaxEvents 100<\/font><\/span><\/i><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">It&#8217;s important to know that Get-WinEvent uses the Windows Event Log to establish the remote connection and does not use the Windows PowerShell remoting for a couple of reasons.&nbsp; First, since the Event Log is installed on every version of Windows Vista and above, you can use it to collect logs without requiring PowerShell Remoting. Secondly, since the cmdlet uses the Event Log&#8217;s remote protocol, any filtering that you pass to the cmdlet will be done on the remote machine. This means that, if you use one of the Filter* parameters of the cmdlet, you&#8217;ll minimize the data sent across the wire since the remote machine does the filtering instead of the local machine.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;If you want to gather data from multiple machines at once, you can do that with a simple script. Note that the events will need to be sorted after this script is run, since the events are gathered from one machine at a time. <\/font><\/span><\/p>\n<table class=\"MsoNormalTable\" border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<tbody>\n<tr>\n<td vAlign=\"top\" width=\"796\">\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\temp&gt; import-csv .\\computers.csv<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">ComputerName<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&#8212;&#8212;&#8212;&#8212;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">127.0.0.1<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">Localhost<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">PS C:\\temp&gt; import-csv .\\computers.csv | %{Get-WinEvent -ComputerName $_.ComputerName -LogName Application, System -MaxEvents 100}<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">TimeCreated<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ProviderName<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Id<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Message<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&#8212;&#8212;&#8212;&#8211;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;&#8212;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;-<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">6\/8\/2009 2:45:59 PM<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Service Control Manager<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>7036<span>&nbsp;&nbsp;&nbsp; <\/span>The Multimedia Class Sched&#8230;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">6\/8\/2009 2:45:59 PM<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Service Control Manager<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>7036<span>&nbsp;&nbsp;&nbsp; <\/span>The Multimedia Class Sched&#8230;<\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">We hope you find the new cmdlet very useful!<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Kevin Woley, Windows Event Log PM&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN\"><font face=\"Calibri\">Osama Sajid, Windows PowerShell PM<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\">&nbsp;<\/font><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In part&nbsp;1 of \u201cEvent logs in Powershell\u201d we talked about differences between Get-EventLog and Get-WinEvent. In this second part we will dig deeper into Get-WinEvent. &nbsp; Starting in Windows Vista, the Windows Event Log was updated to provide a more powerful event model which allows for events to be easily categorized into logs and for [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[160,183],"class_list":["post-3891","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-event-log","tag-get-winevent"],"acf":[],"blog_post_summary":"<p>In part&nbsp;1 of \u201cEvent logs in Powershell\u201d we talked about differences between Get-EventLog and Get-WinEvent. In this second part we will dig deeper into Get-WinEvent. &nbsp; Starting in Windows Vista, the Windows Event Log was updated to provide a more powerful event model which allows for events to be easily categorized into logs and for [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/3891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=3891"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/3891\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=3891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=3891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=3891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}