Add PowerShell exception handling and turn on strict mode.

* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
This commit is contained in:
Chris Church 2015-08-22 18:19:43 -04:00
parent 47d9e7ca93
commit 4b2cdadc98
9 changed files with 286 additions and 22 deletions

View file

@ -167,7 +167,7 @@ class Connection(ConnectionBase):
elif '-EncodedCommand' not in cmd_parts:
script = ' '.join(cmd_parts)
if script:
cmd_parts = self._shell._encode_script(script, as_list=True)
cmd_parts = self._shell._encode_script(script, as_list=True, strict_mode=False)
if '-EncodedCommand' in cmd_parts:
encoded_cmd = cmd_parts[cmd_parts.index('-EncodedCommand') + 1]
decoded_cmd = to_unicode(base64.b64decode(encoded_cmd))