May-29-2017, 03:19 PM
You are overwriting hdd variable in the loop.
It still can be problem on some pc,
because this is accessing at a low level that can restricted.
import wmi hdd = [] c = wmi.WMI() for item in c.Win32_PhysicalMedia(): hdd.append(item) #print(hdd) print(hdd[0])
Output:instance of Win32_PhysicalMedia
{
SerialNumber = "S1ATNEAD7xxxxxx ";
Tag = "\\\\.\\PHYSICALDRIVE1";
};
Quote:It works fine in my pc, but in my client 's pc it returns nothing!Pc most have Pytnhon and wmi installed.
It still can be problem on some pc,
because this is accessing at a low level that can restricted.