简体   繁体   English

在远程计算机上使用WMI Python执行系统命令

[英]Execute system commands using wmi python on remote computer

I am trying to create a directory on a remote computer using wmi and python. 我正在尝试使用wmi和python在远程计算机上创建目录。 I am able to successfully run any batch file by providing the complete path to it. 通过提供完整的路径,我能够成功运行任何批处理文件。 But not execute system command. 但不执行系统命令。

This following code does not create a directory on the remote computer. 下面的代码不会在远程计算机上创建目录。

conn = wmi.WMI('172.20.23.45', user='Administrator', password='Pass@123')
conn.Win32_Process.Create(CommandLine='mkdir temp')

可以这样做。

conn.Win32_Process.Create(CommandLine='cmd.exe /c mkdir temp')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Python和paramiko以root身份执行远程命令 - Execute remote commands as root using Python and paramiko 如何使用 WMI 和 Python 从远程计算机复制文件并将它们存储在本地计算机中? - How to copy files from remote computer and storing them in local one using WMI and Python? 如何连接到远程 Windows 机器以使用 python 执行命令? - How to connect to a remote Windows machine to execute commands using python? 使用python脚本在远程计算机上执行bash命令 - Execute bash commands on remote machine using python script 如何使用 WMI -(Windows Management Instrumentation)从 python 脚本获取远程系统硬件信息 - How can I get remote system hardware information using WMI -( Windows Management Instrumentation) from python script 使用 os.system 从 python 提示符执行命令 - Execute commands from python prompt using os.system 如何在 python 中使用 os.system() 同时执行多个命令 - How to execute multiple commands simultaneously using os.system() in python 使用 Python WMI 在远程系统上运行本地批处理文件 - Run local batch file on remote system with Python WMI Python 2.7:wmi模块:在远程系统上创建交互式进程 - Python 2.7: wmi module: Creating an interactive process on a remote system Python子进程执行远程服务器命令 - Python subprocess to execute remote server commands
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM