kevinoid / remove-nonpresent-devices

Script to remove non-present devices from a Windows computer system
MIT License
31 stars 10 forks source link

Could work on offline systems? #5

Open clngr opened 11 years ago

clngr commented 11 years ago

I'm not sure if this would be possible, but removal of non-present devices from offline systems using RemoveDevices on WinPE could be a good idea too.

By the way, thanks for the script, great work :)

kevinoid commented 11 years ago

Sure, that might be useful. What use cases were you thinking of? (When would you want to remove devices using WinPE?)

I'm not particularly familiar with operating in WinPE. When used for pre-installation/imaging, I wouldn't expect any non-present devices, and when used for recovery, how could the script get access to the devices of the normal environment from WinPE?

Also, is there any reason that it doesn't work as-is in WinPE (at least for removal of devices in the PE environment)? What's the error message that is produced?

clngr commented 11 years ago

Could be useful to help recover systems that doesn't boot anymore, like when a mainboard is replaced and boot is not possible due to unneeded/incompatible device drivers that keeps loading. Usually on this scenario the root cause for a non booting system is a missing SATA driver, but sometimes is unnecessary drivers.

The script could ask or detect location of the offline registry. Some examples of tools that get access to offline registry are RegEditPE (http://regeditpe.sourceforge.net/) and Sysinternals Autoruns.

In PE I've not tried it, doesn't make much sense because PE would not have unnecessary drivers. An offline registry access would be needed.

If this could be done, would be a great feature. If it could be of any help, a ready to use XP WinPE is http://www.hirensbootcd.org/download/.

kevinoid commented 11 years ago

I don't think it is possible for the script to address these scenarios. As far as I know, devcon.exe can't make use of offline registry files (or registry files loaded outside of the hard-coded location). Even if it could, it would not be possible to determine whether the device is present/non-present on the system, which would require initializing the driver in the PE environment (and we have no way of knowing what dependencies the driver may have for initialization).

If I've misunderstood, or there is a way to make this work, I'd be happy to consider it. For now, I'll leave the issue open to encourage anyone with interest to provide a solution. But, unless one is forthcoming, it is unlikely to get implemented. Sorry.

clngr commented 11 years ago

No problem, I thank you for the attention and elaborated answer :)

clngr commented 11 years ago

I've found an interesting app that could help on the script development:

GhostBuster http://ghostbuster.codeplex.com/

On my tests, it found a lot of unecessary drivers that RemoveDevices left untouched:

Clipboard