Searching Multiple Output Logs

Question: Is there a way to automatically save all output logs from a deployment to a specified folder to quickly search for a word or phrase and flag those targets?

Background:

I have a deployment that is scanning for Windows component store corruption.  It's a simple Powershell line:

Dism /Online /Cleanup-Image /ScanHealth

I am looking for a way to search all Output logs for the word "repairable".  I use Effective File Scan which can search within file content and return a list of file names.  At the moment, I quickly opened each log file through PDQ Deploy then closed it - this pulled a copy of the output log into the temp folder on the PDQ server through which I can then search:

\\PDQServer\C$\Users\pdqadmin\AppData\Local\Temp\PDQDeployConsole\8356\PDQDeploy.Output

I know that the GZ files are saved here:

C:\ProgramData\Admin Arsenal\PDQ Deploy\Deployment Output

If I extract the files, they don't identify the target within the file name which prevents this from being an efficient approach.

Thanks very much in advance!

1

Comments

2 comments
Date Votes
  • 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
    }
    1
  • 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
    $Result
    if ( $Result -Match "repairable" ) {
    Exit 10
    }
    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post