Answer the question
In order to leave comments, you need to log in
How to get an event in the event log about connecting a USB device?
Hello,
how do I get an event in the event log about connecting a USB device? Not mass storage, it's written about it everywhere, but any device? Yes, with the ability to filter by VID / PID? Only necessarily by means of Windows itself.
I feel that somehow it is possible, but so far I have not found such a method.
Answer the question
In order to leave comments, you need to log in
Periodically call all sorts of SetupDi and check what appeared in the list ...
Approximately described here
stackoverflow.com/questions/7599331/list-usb-devic...
It won’t work for everyone at once, there are different event codes for different devices and all that.
try filtering by:
ServiceName - UserPnp, event codes: 20003 (MTP device being installed), 20001 (camera being installed)
or DeviceInstanceID - USB
Can be done in PowerShell using WMI or WMI Events.
( https://technet.microsoft.com/en-us/library/ff7309...
and using WMIExplorer you can experiment with requests like:
- select * from CIM_USBDevice
And register its execution in the Service or in Autorun, but here you need to experiment Can
you find out what problem or task you want to solve with this?
What if you install PC monitoring software that also monitors all connected devices ... or maybe block it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question