I’m novice to powershell. I want a script to write to a txt file when log 4720 is generated the following information: date and time of event ID, Subject: Account Name, New Account: Account Name.
I succeeded to extract only the date and time.
First of all - when you post code, error messages, sample data or console output format it as code, please.
Here you can read how that works: Guide to Posting Code.
Now to your challenge … unfortunately the information you’re after are hidden in the “Message” property of the returned object. So you have to do some regex acrobatics to cut them out of the rest of the message body.