- 1 year ago
Get plugged/unplugged datetime of USB device using Windows registry keys
To retrieve the plugged/unplugged datetime of a USB device using Windows registry keys, you can follow these steps:
Open the Registry Editor: Press Win + R on your keyboard to open the Run dialog box. Type
regedit
and press Enter. This will open the Registry Editor.Navigate to the USB device key: In the Registry Editor, navigate to the following registry path:
graphqlHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
Identify the specific USB device: Under the
USB
key, you will find multiple subkeys representing different USB devices connected to your system. Browse through the subkeys to locate the one corresponding to the USB device you are interested in. Each subkey represents a unique USB device and has a unique device ID.Retrieve the plug/unplug datetime: Within the USB device subkey, you can find registry values containing information about the device, including the plug/unplug datetime. Look for the following registry values:
For plugged datetime:
graphqlHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\<device-subkey>\Device Parameters\LastPlugTime
For unplugged datetime:
graphqlHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\<device-subkey>\Device Parameters\LastUnplugTime
The
LastPlugTime
value represents the datetime when the USB device was last plugged in, and theLastUnplugTime
value represents the datetime when the USB device was last unplugged.The datetime values are stored as FILETIME format, which is the number of 100-nanosecond intervals since January 1, 1601 (UTC). You can convert this value to a more human-readable format using programming languages or tools that support FILETIME conversion.
Please note that modifying or interacting with the Windows Registry can have serious consequences if not done properly. Take caution while navigating and reading registry keys.