docs: def _pshell(cmd, cwd=None, json_depth=2):
      '''
      Execute the desired powershell command and ensure that it returns data
      in json format and load that into python
      '''
      if 'convertto-json' not in cmd.lower():
          cmd = '{0} | ConvertTo-Json -Depth {1}'.format(cmd, json_depth)
      log.debug('DSC: %s', cmd)
      results = __salt__['cmd.run_all'](cmd, shell='powershell', cwd=cwd, python_shell=True)
  
      if 'pid' in results:
          del results['pid']
  
      if 'retcode' not in results or results['retcode'] != 0:
          # run_all logs an error to log.error, fail hard back to the user
          raise CommandExecutionError('Issue executing powershell {0}'.format(cmd), info=results)
  
      try:
          ret = salt.utils.json.loads(results['stdout'], strict=False)
      except ValueError:
          raise CommandExecutionError('No JSON results from powershell', info=results)
  
      return ret