Oh my. can run a script file. But if you do that, you no longer can redirect stdout and stderr. Why? Because the file parameter needs to receive the last argument in the command... and stdout redirects also need to be the last argument in the command... so those get ignored.

Solution: invoke powershell twice:

powershell -command "powershell -file myscript.ps1" 1>>stdout.log 2>>stderr.log

And thanks, Microsoft.

Follow

I have published a script that lets us attach files to an email, send the email, and archive the files:
gist.github.com/aeveltstra/52f

· · Web · 0 · 0 · 0
Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!