Now, of course, as well as creating that document,
you may also want to either export the event log information and
store it in that same place or you may want to inject those values
directly into the actual document itself.
So you have that flexibility,
as well as being able to go through and retrieve those values.
So if I just clear this for a second here.
I'm going to call it logentries, and we'll say Get‑WinEvent.
And I want those from, let's do it from the system one.
And I'm not going to filter anything here.
I'm just going to say logentries.
If we just make sure that's got values, which it will do.
It's a whole list of them, so let me just clear that here.
What I can then do is do the same thing that we did before,
which was go through and say add a content section here,
so let's just do Content, Log Details, and then I can say Add‑Content $report,
and then I'm going to say logentries.
Now what does that do to the file?
Well, that will significantly increase the size of it.
And if we scroll all the way down, you can see it adds an interesting thing.
It adds it as an object type instead of the actual record itself.
So that's where we would need to adjust the actual query that we're
getting in the log entries where you would say Select‑Object and
then specify the field that you wanted.
So I'm going to say logentries.
Okay, there's everything.
I can then pick the specific field I'm after.
So let's say I want the message, so I'm going to say log entry Message,
like so, log entries. And I get a whole list of those.
Now what I can do is I'm going to go back to my file here, just
scroll all the way down until we're above the record entries, and
I'm going to delete them because we don't need them all, all the
way down to the bottom here.
Delete.
I'm going to click Save, and then I'm going to rerun that option.
If I then go back to the file, you can see I've got this big list
now, and you'll see all the names and things.
Now, obviously, it needs to be a better field and maybe
formatted differently, but you can combine values that you query
from the machine, such as network adapters and things like that,
with exported values as well.
And, of course, worst case, you could export it as part of the process, so
when the script runs, it will retrieve the information,
put it in the document, and then export the various files as needed.
But that's an example of how to get values and put them all together.