![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Log Parser - Plain, COM, .NET First the plain Log Parser version. Windows PowerShell Copyright (C) 2006 Microsoft Corporation. All rights reserved. PS> LogParser "SELECT text FROM '$pshome\default.help.txt' WHERE text LIKE '%get -help%'" -i:textword -stats ffText ---------- Get-Help get-help "Get-help" get-help get-help get-help get-help get-help get-help get-help PS> Next the COM Log Parser version. Windows PowerShell Copyright (C) 2006 Microsoft Corporation. All rights reserved. PS> $lpTextwordInputFormat = new-object -com "MSUtil.LogQuery.TextWordInputFormat" PS> $lpNativeOutputFormat = new-object -com "MSUtil.LogQuery.NativeOutputFormat" PS> $lpQueryObject = new-object -com "MSUtil.LogQuery" PS> $null = $lpQueryObject.ExecuteBatch("SELECT text FROM '$pshome\default.help.txt' WHERE text LIKE '%get-help%'", $lpTextwordInputFormat, $lpNativeOutputFormat) Text ---------- Get-Help get-help "Get-help" get-help get-help get-help get-help get-help get-help get-help Ps> Execute query and receive a LogRecordSet. PS> $recordSet = $lpQueryObject.Execute("SELECT text FROM '$pshome\default.help.txt' WHERE text LIKE '%get-help%'", $lpTextwordInputFormat) PS> do { >> $record = $recordSet.GetRecord() >> $record.GetValue(0) >> $recordSet.MoveNext() >> } while ($recordSet.atEnd() -eq $false) >> Get-Help get-help "Get-help" get-help get-help get-help get-help get-help get-help get-help PS> Next the .Net Log Parser version. Windows PowerShell Copyright (C) 2006 Microsoft Corporation. All rights reserved. PS> [system.reflection.assembly]::Loadfile("C:\Program Files\Log Parser 2.2\Interop.MSUtil.dll") GAC Version Location --- ------- -------- False v1.1.4322 C:\Program Files\Log Parser 2.2\Interop.MSUtil.dll PS> $lpTextwordInputFormat = new-object Interop.MSUtil.COMTextWordInputContextClassClass PS> $lpNativeOutputFormat = new-object Interop.MSUtil.COMNativeOutputContextClassClass PS> $lpQueryObject = new-object Interop.MSUtil.LogQueryClassClass PS> $null = $lpQueryObject.ExecuteBatch("SELECT text FROM '$pshome\default.help.txt' WHERE text LIKE '%get-help%'", $lpTextwordInputFormat, $lpNativeOutputFormat) Text ---------- Get-Help get-help "Get-help" get-help get-help get-help get-help get-help get-help get-help PS> All done showing all three plain, COM, and .NET Log Parser 2.2 query versions. |
| | #2 (permalink) |
| Guest | RE: Log Parser - Plain, COM, .NET Thank you. "Flowering Weeds" wrote: > > > First the plain Log Parser version. > > Windows PowerShell > Copyright (C) 2006 Microsoft Corporation. All rights reserved. > > PS> LogParser "SELECT text FROM '$pshome\default.help.txt' WHERE text > LIKE '%get > -help%'" -i:textword -stats ff> Text > ---------- > Get-Help > get-help > "Get-help" > get-help > get-help > get-help > get-help > get-help > get-help > get-help > PS> > > Next the COM Log Parser version. > > Windows PowerShell > Copyright (C) 2006 Microsoft Corporation. All rights reserved. > > PS> $lpTextwordInputFormat = new-object -com > "MSUtil.LogQuery.TextWordInputFormat" > > PS> $lpNativeOutputFormat = new-object -com > "MSUtil.LogQuery.NativeOutputFormat" > > PS> $lpQueryObject = new-object -com "MSUtil.LogQuery" > > PS> $null = $lpQueryObject.ExecuteBatch("SELECT text FROM > '$pshome\default.help.txt' WHERE text LIKE '%get-help%'", > $lpTextwordInputFormat, > $lpNativeOutputFormat) > Text > ---------- > Get-Help > get-help > "Get-help" > get-help > get-help > get-help > get-help > get-help > get-help > get-help > Ps> > > Execute query and receive a LogRecordSet. > > PS> $recordSet = $lpQueryObject.Execute("SELECT text FROM > '$pshome\default.help.txt' WHERE text LIKE '%get-help%'", > $lpTextwordInputFormat) > PS> do { > >> $record = $recordSet.GetRecord() > >> $record.GetValue(0) > >> $recordSet.MoveNext() > >> } while ($recordSet.atEnd() -eq $false) > >> > Get-Help > get-help > "Get-help" > get-help > get-help > get-help > get-help > get-help > get-help > get-help > PS> > > Next the .Net Log Parser version. > > Windows PowerShell > Copyright (C) 2006 Microsoft Corporation. All rights reserved. > > PS> [system.reflection.assembly]::Loadfile("C:\Program Files\Log > Parser 2.2\Interop.MSUtil.dll") > > GAC Version Location > --- ------- -------- > False v1.1.4322 C:\Program Files\Log Parser > 2.2\Interop.MSUtil.dll > > PS> $lpTextwordInputFormat = new-object > Interop.MSUtil.COMTextWordInputContextClassClass > > PS> $lpNativeOutputFormat = new-object > Interop.MSUtil.COMNativeOutputContextClassClass > > PS> $lpQueryObject = new-object Interop.MSUtil.LogQueryClassClass > > PS> $null = $lpQueryObject.ExecuteBatch("SELECT text FROM > '$pshome\default.help.txt' WHERE text LIKE '%get-help%'", > $lpTextwordInputFormat, $lpNativeOutputFormat) > Text > ---------- > Get-Help > get-help > "Get-help" > get-help > get-help > get-help > get-help > get-help > get-help > get-help > PS> > > All done showing all three plain, COM, > and .NET Log Parser 2.2 query versions. > > > > > |
| | #3 (permalink) |
| Guest | Re: Log Parser - Plain, COM, .NET "Flowering Weeds" <floweringnoweedsno@hotmail.com> wrote in message news:%23qU43NkcHHA.2268@TK2MSFTNGP02.phx.gbl... > > > First the plain Log Parser version. > > Windows PowerShell > Copyright (C) 2006 Microsoft Corporation. All rights reserved. > > PS> LogParser "SELECT text FROM '$pshome\default.help.txt' WHERE text > LIKE '%get > -help%'" -i:textword -stats ff> Text > ---------- > Get-Help > get-help > "Get-help" > get-help > get-help > get-help > get-help > get-help > get-help > get-help And finally a plain native PowerShell version :-) : PS> type $pshome\en-us\default.help.txt | ?{$_ -match "(\S*get-help\S*)"} | %{$matches[0]} Jacques |
| | #4 (permalink) |
| Guest | Re: Log Parser - Plain, COM, .NET If I was just processing text, I wouldn't user LogParser. What I'm after is a function that will read a saved Windows Event Log file, and return a custom PS object that approximates the eventlogentry object well enough that a script written to work with the properties of one has a reasonable chance of working with the other. If anyone has a better idea of how best to get PowerShell to work with saved event logs, I'm open to suggestions. "Jacques Barathon [MS]" wrote: > "Flowering Weeds" <floweringnoweedsno@hotmail.com> wrote in message > news:%23qU43NkcHHA.2268@TK2MSFTNGP02.phx.gbl... > > > > > > First the plain Log Parser version. > > > > Windows PowerShell > > Copyright (C) 2006 Microsoft Corporation. All rights reserved. > > > > PS> LogParser "SELECT text FROM '$pshome\default.help.txt' WHERE text > > LIKE '%get > > -help%'" -i:textword -stats ff> > Text > > ---------- > > Get-Help > > get-help > > "Get-help" > > get-help > > get-help > > get-help > > get-help > > get-help > > get-help > > get-help > > And finally a plain native PowerShell version :-) : > > PS> type $pshome\en-us\default.help.txt | ?{$_ -match "(\S*get-help\S*)"} | > %{$matches[0]} > > Jacques > > |
| | #5 (permalink) |
| Guest | Re: Log Parser - Plain, COM, .NET "Jacques Barathon [MS]" > > And finally a plain native PowerShell version :-) : > > PS> type $pshome\en-us\default.help.txt Mmmm PS> LogParser "type $pshome\en-us\default.help.txt" Error: Syntax Error: <select-clause>: no SELECT keyword It seems "a plain native PowerShell version" ran in Log Parser 2.2 does not work! ![]() |
| | #6 (permalink) |
| Guest | Re: Log Parser - Plain, COM, .NET "Rob Campbell" > If I was just processing text, > I wouldn't user LogParser. > If your files are large and at different locations perhaps one would! ![]() > What I'm after is a function that will > read a saved Windows Event Log file, PS> LogParser -h -i:EVT Input format: EVT (Windows Event Log) Parses the Windows Event Log And PS> LogParser -h -i:ETW Input format: ETW (Event Tracing for Windows) Parses ETW binary logs or live trace sessions FROM syntax: <session_name> | <filename_list> Name of an ETW tracing session or comma-separated list of .etl filenames > and return a custom PS object Perhaps first, start with "text" "and return a custom PS object"! |
| | #7 (permalink) |
| Guest | Re: Log Parser - Plain, COM, .NET I'm afraid it's too late to start with text. I've got it reading in unfiltered event log file entries using COM, and am working on looking at the returns from various getvalue operations and how they would map the the object properties. "Flowering Weeds" wrote: > > "Rob Campbell" > > > If I was just processing text, > > I wouldn't user LogParser. > > > > If your files are large and at different > locations perhaps one would! ![]() > > > What I'm after is a function that will > > read a saved Windows Event Log file, > > PS> LogParser -h -i:EVT > > Input format: EVT (Windows Event Log) > Parses the Windows Event Log > > And > > PS> LogParser -h -i:ETW > > Input format: ETW (Event Tracing for Windows) > Parses ETW binary logs or live trace sessions > > FROM syntax: > > <session_name> | <filename_list> > Name of an ETW tracing session or > comma-separated list of .etl filenames > > > and return a custom PS object > > Perhaps first, start with "text" > "and return a custom PS object"! > > > > |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Yep More Log Parser Charting | Flowering Weeds | PowerShell | 0 | 1 Week Ago 02:47 PM |
| Log Parser Get web text | Flowering Weeds | PowerShell | 0 | 06-12-2008 04:37 PM |
| More Log Parser and PowerShell | Flowering Weeds | PowerShell | 2 | 10-27-2007 02:53 PM |
| cannot find MS XML Parser 4.0 | Maverique | Vista General | 7 | 06-27-2007 09:33 PM |
| Looking for HTML parser | Shafik | PowerShell | 1 | 05-08-2007 09:33 PM |