Augustin
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Цитата: [/q] DeviceCleanup V0.7.1.0 - Removes non-present devices from the Windows device management Freeware by Uwe Sieber - www.uwe-sieber.de Works under Window 2000, XP and higher On x64 Windows only the x64 release can delete devices. All devices listed by DeviceCleanup are currently not present, usually they have the problem code 45 which is CM_PROB_PHANTOM, "The devinst currently exists only in the registry". You can select one, multiple or all devices and remove them. If the device is attached again it will be detected as new. The 'last used' time comes from the write time of the device's registry key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum On some Windows the times are set on startup or even while it is running every few hours, so all devices seem to have the same age. On a Windows 7 the Sysinternal ProcessMonitor shows a recurring RegSetKeySecurity caused by a svchost.exe hosting the PlugPlay service every 11 hours 45 minutes. No idea what is causing it. I you want to check yourself: Set a filter "operation is RegSetKeySecurity" and set the option "Filter -> Drop filtered events", otherwise your pagefile (or other backing file) gets flooded in no time. On most Windows the time is set when the device gets active, so it makes sense to use this as 'last used' time. Non-PnP devices and 'soft' devices are not listed because they are not automatically reinstalled. These are devices whose ID begins with - HTREE\ROOT\ - ROOT\ - SW\{ If you want to delete them, use the Windows Device Manager. For removing devices admin privileges are required, otherwise you get an access denied error. Since regular device management functions are used, any removed device's CoInstallers are called as planned, so you might loose for instance custom Explorer icons for card reader volumes. Just have the card reader attached while executing DriveCleanup to prevent this. A command line version is available too: http://www.uwe-sieber.de/misc_tools_e.html#devicecleanupcmd Licence: Freeware Allowed: - usage in any environment, including commercial - include in software products, including commercial - include on CD/DVD of computer magazines - making available for download by means of package managers Not allowed: - modify any of the files - offer for download by means of a "downloader" software Uwe Sieber, mail@uwe-sieber.de June 2017 Добавлено: [q] | DriveCleanup V1.5.0 - removes non present drives from the device tree Freeware by Uwe Sieber (c) 2007-2017 Works under Windows XP and higher only. Under x64 edtitions of Windows only the x64 version works. Removes from the device tree non present - USB hubs - USB mass storage devices - USB Disk devices - USB CDROM devices - USB Floppy devices - USB Storage Volumes - USB WPD devices (Vista, Win7, Win8, Win10) and their registry items under HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EMDMgmt HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\CPC\Volume HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume Usage: DriveCleanup [-t] [-n] [-u] [-d] [-c] [-f] [-v] [-r] no params: cleanup all -t test mode -n no wait for keypress when finished if started standalone -u only USB mass storage devices -d only USB Disk devices -c only USB CDROM devices -f only USB Floppy devices -v only USB Storage Volume devices -r only registry items of USB volumes -w only USB WPD devices Called with admin previleges and without a parameter it removes all types of devices listed above and cleans the registry. Without admin previleges it switches to test mode and shows the items it would remove. Samples: DriveCleanup -t test mode, lists devices and registry items to remove DriveCleanup removes non present devices related to drives and their registry items DriveCleanup -v -d removes non present USB Storage Volumes and USB Disks Administrator previleges are required for cleanup. DriveCleanup isn't stricly limited to drives. USB hubs and the Enum\NextParentID.xxxxx.n values may be not drive related. Deleteing automatically any type of non-present device seems to be too dangerous, therefore I've made a GUI tool for this, so it's up to the user not to delete something important... http://www.uwe-sieber.de/misc_tool_e.html#devicecleanup DriveCleanup calls Windows device manangement functions for deleting devices entries. If it shows OK then Windows responded that this succeeded. When finished DriveCleanup checks all again and should find zero devices if it showed OK for all before. Sometimes Windows says OK but in fact the device is still present. Since regular device management functions are used, any removed device's CoInstallers are called as planned, so you might loose for instance custom Explorer icons for card reader volumes. Just have the card reader attached while executing DriveCleanup to prevent this. Starting with Vista Administrators have no more write access to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum and even being the owner they have no right to change the permissions. Therefore deleting unreferenced NextParentID.xxxxx.n items needs more than admin previleges. To get these, DriveCleanup steals the access token of a system process and impersonates its context to change Enum's security descriptor, then performs the cleanup and restores the security descriptor. Maybe this alerts security software. Since V1.4 volumes of the Windows volume shadow copy facility are't skipped anymore. Before they where skipped because I wasn't sure if it is ok to delete them. Since Microsoft offers it's own tool to do so, I is ok obviously: https://support.microsoft.com/en-gb/help/982210 Licence: Freeware Allowed: - usage in any environment, including commercial - include in software products, including commercial - include on CD/DVD of computer magazines - making available for download by means of package managers Not allowed: - modify any of the files - offer for download by means of a "downloader" software Uwe Sieber July 2017 |