Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read system information in Python on Windows?

Following from this OS-agnostic question, specifically this response, similar to data available from the likes of /proc/meminfo on Linux, how can I read system information from Windows using Python (including, but not limited to memory usage).

like image 399
davidmytton Avatar asked May 27 '26 11:05

davidmytton


2 Answers

In Windows, if you want to get info like from the SYSTEMINFO command, you can use the WMI module.

import wmi

c = wmi.WMI()    
systeminfo = c.Win32_ComputerSystem()[0]

Manufacturer = systeminfo.Manufacturer
Model = systeminfo.Model

...

similarly, the os-related info could be got from osinfo = c.Win32_OperatingSystem()[0] the full list of system info is here and os info is here

like image 196
Alex Okrushko Avatar answered May 30 '26 05:05

Alex Okrushko


There was a similar question asked:

How to get current CPU and RAM usage in Python?

There are quite a few answers telling you how to accomplish this in windows.

like image 38
Adam Peck Avatar answered May 30 '26 05:05

Adam Peck