Retrieving Devices and Printers Information from Control Panel using Python

154 Views Asked by At

I am using Python 3.9.12 and using wmi package. I am trying to retrieve Model name of the mouse and keyboard for my tool. Whenever I am using wmi.Win32_PointingDevice() or wmi.Win32_Keyboard() in order to get the model name; I am getting USB Input Device or Standard system devices.

When I am using the following code, it is opening the GUI for devices and printers. Is there anyway to get the data without opening the GUI? I want the model name of the mouse and the keyboard.

import win32api
import win32con

win32api.WinExec('{0}\\control.exe printers'.format(win32api.GetSystemDirectory()),win32con.SW_NORMAL)

In control panel I can see the model of my mouse and keyboard mentioned.

enter image description here

0

There are 0 best solutions below