Questions about creating an error log

I have a script that I’ve been working on and right now it’s functional but I want to add a few things. The first is some way of generating a log.

During my testing I’ve been using -Erroraction ‘silentlycontinue’ at the end of the main commands to suppress any known warnings or errors so the script would keep running. But now that everything is working as intended I’d like the script to dump any errors to a log file for later review.

I’m assuming that I could continue using -Erroraction ‘silentlycontinue’ but then add -ErrorVariable and then write the variable to a txt file during each pass. Is that a safe assumption or am I going about this wrong?

submitted by /u/Baron164
[link] [comments]

Leave a Reply