Re: get-eventlog search string problem


  1.    03 Dec 2007 #1
    Brandon Shell [MVP] Guest

    Re: get-eventlog search string problem


    I would use -match instead of -like

    For remote Eventlog you should use WMI or .NET

    WMI: Get-WmiObject Win32_NTEventlogFile -computer $computer
    or
    ..NET: [System.Diagnostics.EventLog]::GetEventLogs($computer)

    I have examples of both here
    http://bsonposh.com/modules/wordpress/?p=41

    Brandon Shell
    ---------------
    Blog: http://www.bsonposh.com/
    PSH Scripts Project: www.codeplex.com/psobject

    f> Hi,
    f>
    f> I am looking for "Lun" information from the eventlog and am wondering
    f> why one method works and a couple others doesn't. Must be syntax.
    f> The one that works is:
    f>
    f> get-eventlog -logname system|?{$_.timegenerated -gt "12/3/2007"|
    f> findstr "Lun"
    f>
    f> The one that doesn't work is:
    f>
    f> get-eventlog -logname system|?{$_ -like "*Lun*"}
    f> and
    f> get-eventlog -logname system |?{$_.timegenerated -gt "12/3/2007"} |
    f> select-string -pattern "Lun"
    f> Also, how would I do this to a remote box?
    f>
    f> Thanks in advance,
    f>



      My System SpecsSystem Spec

  2.    03 Dec 2007 #2
    Keith Hill [MVP] Guest

    Re: get-eventlog search string problem


    "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
    news:29d4f6462ab78ca03df5fde974a@xxxxxx

    > I would use -match instead of -like
    Excellent advice. I use -match far more than -like. The pattern matching
    rules for -like don't align with my regex thinking. :-)

    --
    Keith

      My System SpecsSystem Spec

Re: get-eventlog search string problem

Similar Threads
Thread Forum
String search
Hi, How do I do a search on a string? Basically I have a variable : $OS = Get-wmiObject-class"Win32_OperatingSystem"-comp$server foreach...
PowerShell
search and replace string
I have a folder full of php files. I want to replace all occurances of 'geocities.com' with 'tripod.com'. Is there a win32 shell or powershell...
PowerShell
Can Select-String search in-use files?
I run a mail server and frequently need to search through the log files it generates - including today's log. If I run grep I have no problem...
PowerShell
search string in Excel
Hi! I am trying to make a PowerShell script to search a string in Excel. Excel looks like this A B ------------------- abcdv 7...
PowerShell
How to search and replace text in a string
I need to be able to read a filename like "Doe, John" and then convert that into a string like "jdoe" (a username) so I can use it later to apply...
PowerShell
searching for a certain eventlog problem
Hi all i used the following command : get-eventlog -logname application|where-object {$_.timegenerated -gt "01/12/2007"}| findstr "Enrollment...
PowerShell
Search for string in CSV and delete line if string found in line
Hi, don't really know where to start with this one! I've run a report finding all PST files on our network, however, i have a lot of duplicates...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 11:04.
    .