kevinoid / remove-nonpresent-devices

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

Works on Windows 7 X64? #6

Open clngr opened 11 years ago

clngr commented 11 years ago

Hello!

I've tried to run the script on a Windows 7 X64 and had no luck, even using the recommended devcon version

The script runs, says that had removed hundreds of devices and when we run it again, all the devices are still there.

Any help would be greatly appreciated :)

kevinoid commented 11 years ago

First, have you tried running the script in "verbose" mode? If not, run the script with /verbose or --verbose added to the list of command-line arguments and check for any errors in the output.

Otherwise, if you invoke devcon.exe directly, does it work? To test, choose one of the device IDs from the list of removed devices, then run

devcon.exe remove @ID

With ID replaced by the device ID (the @ must precede the device ID in the command). See if it produces any errors. If not, run

devcon.exe findall *

And see if the device ID appears in the output.

clngr commented 11 years ago

Hello kevin,

The script is running from the following BAT:

@echo off pushd "%~dp0"

@cscript.exe RemoveDevices.js

popd exit

I remember that I've tried running it even with SYSTEM credentials. It lists devices being removed, but they remain as nothing happened.

System was unstable, with some hardware issues too. I'll try your tips when possible since I don't have access to the system right now.

Thanks & best regards

rpavlik commented 11 years ago

The version of cscript that's being used (32 vs 64 bit) will affect other things, and varies based on the shell that runs your batch file. I don't recall which cmd.exe gets invoked for batch files off the top of my head, but looking into that might help.

TNT4USMC commented 10 years ago

In order to get the script to run correctly on Windows 7 x64, you have to use a new version of DevCon.exe copied Devcon.exe Version 6.0.6000.16386 to script folder and it works on Windows 7 x64

DavidGP commented 8 years ago

Works great. I have DevCon.exe version AMD64 v.6.1.7600.16385 in the removedevices.js folder.

I found out that I had to run the utility this way:

Wscript.exe "[path to]\removedevices.js"

(from here: http://superuser.com/questions/488763/how-to-run-js-file-from-a-command-line-on-windows)