I am trying to get a return code from a Powershell cmdlet. This return code will be passed to a Saltstack `cmd.run` state (*success\_retcodes* [parameter](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.cmd.html#salt.states.cmd.run))

My cmdlet that should produce an error:`Get-PSSessionConfiguration test`

This will produce an error because *test* session does not exist.
Running `$?` right after always produces `True` whether the above cmdlet fails or not.

The purpose of this exercise is purposely not fail one of my states in Saltstack via the aforementioned parameter which I believe takes a numeral value.
Any suggestions would be appreciated.