I've got a Powershell script question. I have a script that reads in word documents. The script is looking for the text ''Dictated by:" Sometimes the document is two and three pages long, but each page may not have "Dictated by:" on it. I want the script to continue even if that error state is found. Right now, if it comes across a document that does not have "'Dictated by:'" on every page it aborts and does not complete. If there are 1,000 documents, it will abort in the middle wherever it found the error and won't continue on. There's an error that says: "Error Content -
Exception: System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
CategoryInfo: InvalidOperation: (:) , RuntimeException
StackLocation: at , D:\script\Isaacs-Scripts\scripts\get-doctorcount\get-doctorcount.ps1: line 87"