Windows 8.1 Removing USB registry keys automatically?

I am running on Windows 8.1 64-bit OEM, and have installed Windows Updates and drivers for my system (the system was built just over a month ago).

This included drivers for a USB cellular modem (made by uBlox), and I mapped the virtual COM ports it enumerates to known locations using Device Manager (it happens to enumerate around 6 COM ports, I wanted these to number from COM11 through COM16).

I can see the location for this information in the registry at: HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_xxxx&PID_xxxx\...

Normally I run with the USB cellular modem powered off (and have left it in this state for a few days). Hence the USB cellular modem is only visible when showing "hidden devices" in Device Manager.

This week I left my system alone for a few hours and after rebooting and powering the USB cellular modem I noticed that the virtual COM port mapping I defined was lost.

I repeated this (by cloning a previous image of the harddrive and repeating) and it seems that Windows automatically removes the USB cellular modem from the system (i.e. it no longer appears as a device in Device Manager and all of the registry keys in HKLM\SYSTEM\CurrentControlSet\Enum\USB\... have been removed).

To be clear, this system has *only* Windows 8.1, Window Updates and drivers on it (no other 3rd party software, and no registry cleaners).

Does Windows 8.1 contain a mechanism to "clean-out" old USB devices (such as USB cellular modems) that it hasn't seen on the system for a period of time (as part of some house-keeping)?

Is there any mechanism in Windows 8.1 that can explain this behaviour?

Thanks

June 12th, 2015 8:24am

I am running on Windows 8.1 64-bit OEM, and have installed Windows Updates and drivers for my system (the system was built just over a month ago).

This included drivers for a USB cellular modem (made by uBlox), and I mapped the virtual COM ports it enumerates to known locations using Device Manager (it happens to enumerate around 6 COM ports, I wanted these to number from COM11 through COM16).

I can see the location for this information in the registry at: HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_xxxx&PID_xxxx\...

Normally I run with the USB cellular modem powered off (and have left it in this state for a few days). Hence the USB cellular modem is only visible when showing "hidden devices" in Device Manager.

This week I left my system alone for a few hours and after rebooting and powering the USB cellular modem I noticed that the virtual COM port mapping I defined was lost.

I repeated this (by cloning a previous image of the harddrive and repeating) and it seems that Windows automatically removes the USB cellular modem from the system (i.e. it no longer appears as a device in Device Manager and all of the registry keys in HKLM\SYSTEM\CurrentControlSet\Enum\USB\... have been removed).

To be clear, this system has *only* Windows 8.1, Window Updates and drivers on it (no other 3rd party software, and no registry cleaners).

Does Windows 8.1 contain a mechanism to "clean-out" old USB devices (such as USB cellular modems) that it hasn't seen on the system for a period of time (as part of some house-keeping)?

Is there any mechanism in Windows 8.1 that can explain this behaviour?

Thanks

Free Windows Admin Tool Kit Click here and download it now
June 16th, 2015 8:28am

Some more information:

The problem is that previously connected USB devices are removed from the system after a period of time. This problem does not exist in Windows 7 (I've not got 8 to test, but it's definitely a problem in 8.1).

The problem as also been noted by others, specifically Amazon in Server 2012:

http://aws.amazon.com/windows/products/ec2/server2012r2/network-drivers/

I believe that the Scheduled Task "Windows->Plug and Play->Plug and Play Cleanup" is force removing the registry keys for various USB plug and play devices after a set period of time (in essence it's removing them from Device Manager).

From it's description:

"...This task will also remove state used by devices that have not been detected on this system for a long period of time."

So this behaviour seems to be intentional, but is problematic as I have devices (such as my cellular modem) that are used infrequently but must appear with the correct configuration and these are being removed.

After more testing it seems that not all plug-and-play devices are removed...

Are there any extra settings/registry keys to direct this scheduled task to leave some plug-and-play devices alone?

What is the logic used by this task to determine what plug and play devices to remove?

Why has Microsoft's added this task to Windows 8.1 (what is it's intended purpose, or what problem is it trying to fix)? I can understand Windows doing general housekeeping, but deciding it knows best and removing devices from my system is not what I expect Windows to do.

Is the best fix for me just to disable this scheduled task from running (hence the devices are left on the system and are no longer removed)?

June 16th, 2015 8:29am

Hi

I cannot confirm that Windows refresh the HKLM\SYSTEM\CurrentControlSet\Enum\USB container when reboot, but consider that it is related to USB port, it is possible. To work around this issue, simply create this value by using a script at startup.

If you are interesting on who refreshed this registry, we could perform a trace by using process monitor boot trace.

Boot trace example by using process monitor

http://blogs.technet.com/b/markrussinovich/archive/2012/07/02/3506849.aspx

Regards,

D. Wu

Free Windows Admin Tool Kit Click here and download it now
June 17th, 2015 1:42am

There is another entity that manages COM port names, separate from the thing that manages the Enum tree.  Maybe it could reclaim stale COM name assignments. The WDK (drivers)  forum is the best place to ask about this.

Regards,

-- pa


  • Edited by Pavel A Wednesday, June 17, 2015 7:02 AM
June 17th, 2015 7:00am

To be clear, this isn't a specifically COM-port name related problem.

A variety of USB devices have their configuration removed after a period of inactivity, including HID (mouse/keyboard), memory sticks, cellular modems, Bluetooth devices.

This behaviour is stopped by disabling the scheduled task I mentioned (Plug and Play Cleanup).

This behaviour is not present in previous version of Windows (i.e. Windows 7).

What I am after are some details regarding the decision logic taken by this task (as not all USB devices are cleared), and the reason Microsoft added it?

Also if there are any hooks/settings at the driver level that can inform the task that this device shouldn't be removed?

Cheers,

Joe

Free Windows Admin Tool Kit Click here and download it now
June 18th, 2015 3:26am

Then, definitely do ask in the WDK forum.

- pa

June 20th, 2015 4:38am

I agree that disabling this task stops the problem, but that is a very blunt fix (as the scheduled tasks performs useful work as well as removing driver state).

I am more interested in any mechanism to stop the specific behaviour of the task, or to stop the task from removing the state for specific drivers.

At the very least I'd like to understand Microsoft's intent for this task as having a task that decides to remove devices from the system at some pre-defined interval with no control for the user seems like a rather strange thing to do...

Free Windows Admin Tool Kit Click here and download it now
July 1st, 2015 3:18am

You have received reply in the WDK forum, from the most competent people in that area. If you have further questions, please go ahead and ask there.

-- pa

July 1st, 2015 3:40pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics