简体   繁体   中英

how to read network computer files by wmi in python

I am using wmi module in python for network connection. I need to read all files which are present in network computer drives. So give me suggestion how can i do by using wmi module.

I have done connection by below code and now i need to read files inside network computer drive.

import wmi

ip = '192.168.1.18'
username = 'xxxxxx'
password = 'xxxxxx'
connection = wmi.WMI(ip, user=username, password=password)
for disk in connection.Win32_LogicalDisk (DriveType=3):
    print disk.Caption

WMI does not have anything to read/write file content. You can only read the meta data associated with a file using CIM_DataFile but not the content of the file. So, all you need to do is enumerate the files using CIM_DataFile and use one of the shell commands to read the content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM