A family of System Center products that provide an automation platform for orchestrating and integrating both Microsoft and non-Microsoft IT tools.
Hi,
If you want to get system information on a Windows machine using Python, you can use the pywin32 and wmi libraries. Here’s a simple example of how you can get USB information:
Python
import wmi
# Initialize the WMI interface
c = wmi.WMI()
# Query for USB devices
for usb in c.Win32_USBControllerDevice():
print(usb.Dependent)
This will print out a list of all USB devices connected to your system.
To save this information to a file, you can modify the code like this:
import wmi
# Initialize the WMI interface
c = wmi.WMI()
# Open the output file
with open('output.txt', 'w') as f:
# Query for USB devices
for usb in c.Win32_USBControllerDevice():
print(usb.Dependent, file=f)
This will write the output to a file named output.txt.
Please note that you’ll need to install the pywin32 and wmi libraries if they’re not already installed. You can do this with pip:
pip install pywin32 wmi
Remember to run these scripts with appropriate permissions as accessing hardware information often requires administrator privileges. Also, please be aware that the exact information available may vary depending on the specific devices connected to your system and the version of the Windows operating system your system is running.
I hope this helps! Let me know if you have any other questions. 😊