How can I execute command on remote Windows using Python? Best methods and examples?

14 Replies, 2128 Views

I’ve had success with `fabric` for remote execution, but it’s more Linux-focused. For Windows, I’d second the pywinrm suggestion. It’s reliable and well-documented.

One gotcha: if you’re dealing with older Windows versions, WinRM might not be enabled by default. You’ll need to configure it manually, which can be a bit of a headache.

Also, if you’re open to alternatives, you could look into `psexec` from Sysinternals. It’s not Python-based, but you can call it from Python using `subprocess`.

Here’s a link to psexec: https://docs.microsoft.com/en-us/sysinte...ads/psexec

Good luck with your project!

Messages In This Thread



Users browsing this thread: 1 Guest(s)