In a command prompt, Try this out:
powershell aaa
echo ErrorLevel is %errorlevel%
Powershell will fail (with an error). You will also see "ErrorLevel is 1". This is because it runs aaa as a script, which makes an unhandled error, which sets the errorlevel.
However, now try this:
powershell '
echo ErrorLevel is %errorlevel%
Powershell will fail (with an error). This time, you will also see "ErrorLevel is 0".
I realize it's a different problem. Powershell even will say it's a ParserError, and it's because I screwed up the command line arguments. Still, that's not cool.
I am unclear as to why it behaves this way. I'm guessing this was an oversight. Other programs out there neglect setting errorlevel on failures, but in this case it's as if they went halfway. It's even setting it to 0 here as opposed to not setting it at all.