Searching Multiple Output Logs



  • Colby Bouma

    There's no built-in way to search multiple output logs. I would recommend searching for "repairable" in your script and throwing a non-zero exit code so you can search for it in the Error column.

    I'm thinking something like this (I haven't tested this):

    $Result = Dism /Online /Cleanup-Image /ScanHealth$Result
    if ( $Result.Contains("repairable") ) {
        Exit 10
    Comment actions Permalink
  • Dan Carp

    Thank you so much, Colby - your code got me most of the way there.  I had to use Match instead of Contains (the latter was being finicky) and dropped $Result from the end of your first line onto its own, and it's now working perfectly now for my needs.  Cheers!

    $Result = Dism /Online /Cleanup-Image /ScanHealth
    if ( $Result -Match "repairable" ) {
    Exit 10
    Comment actions Permalink

Please sign in to leave a comment.