This is an exempt of my powershell script: If the video file is not a re-scanned file,…
- User
This is an exempt of my powershell script: If the video file is not a re-scanned file, add it to the scan history
If (!RescanVideo) { #If the video has been deleted, do not log the file name in scanHistory file for scanning again at a later time. If (!(Deleted)) { # Get the updated Original file name if the file was repaired global:OriginalFile.DirectoryName -ChildPath NewFileName = global:RepairedFile.Extension Try { NewFileName -File -ErrorAction Stop } Catch { # If no matches are found, do nothing } If (scanHistory scanHistory $fullName -Encoding utf8 } } }
- Assistant
To address the warning from PSScriptAnalyzer about the empty
catchblock, you can refactor your code to avoid using atry-catchaltogether in this scenario. The goal is to check if the file exists and proceed accordingly without suppressing potential errors that might need attention.