Captured data in variable not listed in final out-file .txt output…

Welcome Forums General PowerShell Q&A Captured data in variable not listed in final out-file .txt output…

Viewing 3 reply threads
  • Author
    Posts
    • #258665
      Participant
      Topics: 4
      Replies: 3
      Points: 43
      Rank: Member

      Hi all,

      I wrote the following script to pull event IDs relating to CVE-2020-1472 which works fine, except it does not write the value of the $Err variable to my final text export

      Running the script in ISE I can view the content of $Err and see its value in the final collection but for some reason it will not appear in my final export, I thought it was due to the variable being an object rather than a string but this seems to not be the case can anyone help?

      Thanks!

    • #258671
      Participant
      Topics: 12
      Replies: 541
      Points: 1,314
      Helping Hand
      Rank: Community Hero

      lines 16 and 17 should reference $ev not $GetEvent

    • #258689
      Participant
      Topics: 4
      Replies: 3
      Points: 43
      Rank: Member

      Thank you Sam,

      I have corrected those lines and the script runs as expected for the first part of the data capture

      However, I cannot understand why after running the script the values $ErrorDetail and $Err both contain the exception.message value as a string but it is not placed into my final txt file?

      • This reply was modified 1 month ago by grokkit. Reason: whitespace
    • #258883
      Participant
      Topics: 4
      Replies: 3
      Points: 43
      Rank: Member

      Thank you Rob for your detailed explanation, I see now how the collections do not need to be assigned to a variable

      Also I agree with your statement that I would indeed want to collect all errors

      Thanks for all of your help guys!

Viewing 3 reply threads
  • You must be logged in to reply to this topic.