make script more robust

  • Are you referring to the multiple job outputs?  We have a nightly process that copies previous days logs\output to a archive folder, so actually we won't get multiple outputs.

     

     

  • Jeff,

    Looks like your mockup is exactly what I looking for, it doesn't seem to be finding anything from match_array . Would case

    have any bearing on Matches?

    Thanks again for your help much apprciated.

  • Yes, case is important.  You can use -ilike I think.

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • I tried to goggle what you mentioned but above, but didn't find examples..

    Thanks.

  • When I run this code:

    It pops up a message:

    cmdlet Export-Csv at command pipeline position 1

    Supply values for the following parameters:

    InputObject:

    Not sure why it's doing this..

    $match_array = "error", "failed";
    $folders = Get-Content "c:\temp\ListOfFolders.txt";
    $folders | % {
    $folder = $_;
    $match_array | % {
    $matched_items = Get-ChildItem $folder | Select-String -Pattern $_ | Select-Object -Property Path,LineNumber,Line;
    Export-CSV "c:\temp\ErrorCapture0413.csv" -Append -NoTypeInformation;
    }
    }
  • You need to pass something to export-cdv

    $matched_itrms | Export-Csv ...

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply