Fast way to Remove Hidden Devices on Virtual Machines

Fast way to Remove Hidden Devices on Virtual Machines

Hi Guys,

after virtualization a lot of unused devices remain on your windows system, there are different way to clean your system, most common is

      open a command shell, type "set DEVMGR_SHOW_NONPRESENT_DEVICES=1" and then "devmgmt.msc"

Another way I've found is to use Kevin Locke's script klocke@digitalenginesoftware.com and Microsoft Devcon.

I've build an iso with everything you need. Just download ISO from my website (http://www.breakbit.com/remdev.iso), mount in your VM, choose the right folder (i386, x64, or ia64 for Itanium CPU) and run the contained "removedevices.js" script (right click and then "Open with command prompt").

The script show you VM hidden devices, just answer "Y" for deleting and it does the "dirty work" totally unattended.

That save me a lot of time! Many thanks to Kevin.

Now add

Smiley Happy

Massimo "Break" Biagi

Comments

Quite a cool script! Thanks for that!

But in my case it did not work on x64 system windows server 2003.

Get "Error: Unable to execute devcon.exe: The image file devcon.exe findall * 2>&1 is valid, but is for a machine type other than the current machine." ... when executing removedevices.js in ia64. Executing removedevices.js in i386 folder found hidden devices but did not remove them.

Has anyone fixed this problem?

this error comes running the x64 version of devcon with Itanium CPU, right?

Here the x64 compiled version for DEVCON, I'll put on REMDEV.ISO asap...

http://www.breakbit.com/devcon_x64.zip

This x64 version  of devcon.exe will work on XP64 and Vista64 with AMD64 processors (e.g.  Intel Core 2 / Intel Xeon and AMD Phenom / Athlon 64)  but WILL NOT WORK on Itanium (ia64) processors.

Now remdev.iso contains x64 devcon version too, let me know if it works! Smiley Happy


Now remdev.iso contains x64 devcon version too, let me know if it works! Smiley Happy

Okay, I mixed up x64 and ia64...

When using right version for right system everything works fine now Smiley Happy

Thx!

Thanks for this script! I am only having one issue out of it - If my default script host happens to be set to WScript, the script will fail with an error - variable args undefined, which is pointing to this block of code:


// Make sure we are running with CScript so user can see output
if (!/cscript\.exe$/i.test(WScript.FullName)) {
    var cmdline = "cscript.exe";
    cmdline += " \"" + WScript.ScriptFullName + "\"";
    for (var i=0; i<args.length; ++i)
cmdline += " \"" + args(i) + "\"";

    WShell.Run(cmdline, 1, false);
    WScript.Quit(0);
}

I've done similar checks in vbscript that will switch the default script host if necessary, but not sure how to do this in jscript. If I manually change my default script host to CScript, this scripts works without error. How can I get the script to work as-is with no errors when my default script host is WScript?

Thanks,

James

Version history
Revision #:
1 of 1
Last update:
‎03-17-2011 02:19 AM
Updated by: