For certain resource types (typically physical ports), using "synchronous" (or even "semi-synchronous") WQL queries can interrupt (or even cause denial of service on) the services managing those resources.
An example is that if you query win32_LogicalDisk
while inserting a USB flash storage device, it can fail to mount as a logical volume.
You probably need to make an an "asynchronous" query.
Reference: How to perform Asynchronous WMI WQL queries. (C#
)
There are two varieties of "asynchronous" WQL query consumers: "temporary" and "permanent".
"Temporary" consumers are programs where you just run a polling loop, sending an "asynchronous" WQL query with some timeout (say 2 seconds). If nothing occurs within the timeout, the query returns an empty result-set, and you restart the loop (send another query).
"Permanent" consumers are registered with the WMI services themselves. PowerEvents for Windows Powershell is a good example of tooling in this area.