code: def win_cmd(command, **kwargs):
      '''
      Wrapper for commands to be run against Windows boxes
      '''
      logging_command = kwargs.get('logging_command', None)
  
      try:
          proc = NonBlockingPopen(
              command,
              shell=True,
              stderr=subprocess.PIPE,
              stdout=subprocess.PIPE,
              stream_stds=kwargs.get('display_ssh_output', True),
              logging_command=logging_command,
          )
  
          if logging_command is None:
              log.debug(
                  'Executing command(PID %s): \'%s\'',
                  proc.pid, command
              )
          else:
              log.debug(
                  'Executing command(PID %s): \'%s\'',
                  proc.pid, logging_command
              )
  
          proc.poll_and_read_until_finish()
          proc.communicate()
          return proc.returncode
      except Exception as err:
          log.exception('Failed to execute command \'%s\'', logging_command)
      # Signal an error
      return f win_cmd(command, **kwargs):
      '''
      Wrapper for commands to be run against Windows boxes
      '''
      logging_command = kwargs.get('logging_command', None)
  
      try:
          proc = NonBlockingPopen(
              command,
              shell=True,
              stderr=subprocess.PIPE,
              stdout=subprocess.PIPE,
              stream_stds=kwargs.get('display_ssh_output', True),
              logging_command=logging_command,
          )
  
          if logging_command is None:
              log.debug(
                  'Executing command(PID %s): \'%s\'',
                  proc.pid, command
              )
          else:
              log.debug(
                  'Executing command(PID %s): \'%s\'',
                  proc.pid, logging_command
              )
  
          proc.poll_and_read_until_finish()
          proc.communicate()
          return proc.returncode
      except Exception as err:
          log.exception('Failed to execute command \'%s\'', logging_command)
      # Signal an error
      return 1
docs: Wrapper for commands to be run against Windows boxes