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
    ..NET: [System.Diagnostics.EventLog]::GetEventLogs($computer)

    I have examples of both here

    Brandon Shell
    PSH Scripts Project:

    f> Hi,
    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> get-eventlog -logname system|?{$_.timegenerated -gt "12/3/2007"|
    f> findstr "Lun"
    f> The one that doesn't work is:
    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> Thanks in advance,

      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

    > 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. :-)


      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...
search and replace string
I have a folder full of php files. I want to replace all occurances of '' with ''. Is there a win32 shell or 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...
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...
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...
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...
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...

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 01:35.