libb.psexec_session

class psexec_session(host, password)[source]

Bases: object

Context manager for running psexec commands.

Mounts admin share before commands and unmounts on exit.

Parameters:
  • host (str) – Remote host name or IP.

  • password (str) – Password for authentication.

Example:

with shell.psexec_session(host, password):
    for cmd in commands:
        out = shell.run_command(cmd)