I added the transcript option to my script. Using the start-transcript. What I want is to have event logs to be added into the transcrpt. I know you can use get-eventlog -logname application... But I want to add specific logged events into the transcript. Like,
start-transcript -append eventlogs, something like that. Any thoughts?
I am not sure the -append would be able to do what you want.
I just took a look at the description for -append, and my understanding of it, is that your start-trascript -append would merely use the end of another transcript as its starting point. For instance
Start-transcript -append ./transcriptprevious.txt
This command would now start the transcription process, but it starts it at the end of another transcription file. I hope I explained that correctly.
If you are wanting to get eventlogs added to a file, why not just do a
get-eventlog -logname application |out-file ./events.txt
Or if you wanted to add more events to the above file
get-eventlog -logname application >> ./events.txt
Yes so I added the -append switch to the start-transcript. Also did a >> with get-eventlog so it would append that info to the info in the transcript. Problem is that it's throwing the error "unable to access the file as another person or process is all ready using it". So how would I get the info from get-eventlog to add its info to the file from the transcript. Bascially im wanting to have the entire shell session logged into the transcript and also any application events as well. ANy thoughts..?
Ok so I was doing some further digging and realized that when a file in in use by start-transcript, that file appears to become locked from use by any other cmdlets. So what I did was this:
start-transcript output file is C:\transcript.txt
Run cmdlet, run test
get-eventlog >> C:\transcript.
By doing this it appends the get-eventlog to the transcript file. That is what I have found so far.