I am getting the following non-terminating error in PowerShell. I want to catch this and write-host a generic statement, rather than see the error.
Here is the output:
You cannot call a method on a null-valued expression. At C:\PowerShell Scripts\windowsUpdates.ps1:17 char:2 + $a = $key.GetValue("LastSuccessTime") + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRec ordException + FullyQualifiedErrorId : InvokeMethodOnNull
My catch statement is currently not "catching" this.
Any help is appreciated.