python远程登录windows系统
首先安装wmi 命令:pip install wmi
然后会报错缺少pywin32-219.win-amd64-py2.7.exe包,去下面这个地址下载
Http://sourceforge.net/projects/pywin32/files/pywin32/寻找适合自己电脑位数和python的包下载安装
下面是远程连接的代码:
# encoding:utf-8
import wmi
def sys_version(ipaddress, user, passWord):
conn = wmi.WMI(computer=ipaddress, user=user, password=password)
for sys in conn.Win32_OperatingSystem():
print "Version:%s" % sys.Caption.encode("UTF8"),"Vernum:%s" % sys.BuildNumber #系统信息
print sys.OSArchitecture.encode("UTF8") # 系统的位数
print sys.NumberOfProcesses # 系统的进程数
if __name__ == '__main__':
sys_version(ipaddress="ip", user="用户名", password="密码")
相关文章