Disable/Enable USB Devices in Windows Manager With Script

FUSION CHA0S

New member
Local time
6:41 PM
Messages
2
My scenario is as is...

We have a ton of companies running windows 2008 (HP ML110G8) servers. These servers have zebra label printers installed on them. We have noticed that these printers will lock up and stop printing until the end user unplugs the device and plugs it back into the computer. It will then print and work fine. As this happens frequently, we need to find an easier way.

On our windows 2003 servers (ML110 G5), we created a devcon batch script that could run when the end user selected it. To my knowledge, devcon is not obtainable without downloading it to a 2008 server.

Is there a simple script i can use to disable a usb device in computer management?

I have looked into WMI, powershell, and other batch files. But it seems like devcon is the only way if i download it. Is there a way to install devcon within the batch file so i can install it to the directory and then run the command all at once?

Im willing to write code, i am not known to devcon
 

My Computer

Computer type
PC/Desktop
OS
Windows 7
Hi and welcome to Sevenforums!

DevCon is a stand-alone executable so no install is needed. You can extract it from a WDK(Windows Driver Kit) but make sure you get the correct version for the OS architecture.
http://blogs.technet.com/b/deploymentguys/archive/2009/12/16/where-to-find-devcon-exe.aspx
http://social.technet.microsoft.com...ion-of-device-console-utility-devcon-exe.aspx

If you download it and then put devcon.exe on a local file server you can have the batch file copy it to a local folder from there, before executing the devcon commands.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
I believe this is to download and extract the devcon from the package. This is something we cannot do as we would have to do this for 1500 computers. I am also to believe the changing the value of the usbstor does nothing or unless you have to restart the registry to take affect (which you would need to restart the computer). Is there a known wmi script or a different script that could do what devcon does? i have search endlessly to find anything else but devcon... :/
 
Last edited:

My Computer

Computer type
PC/Desktop
OS
Windows 7
As far as i am thinking this problem goes to the printer spooler. This link i have found may give you more ideas: Print Spooler either Hangs or Crashes due to a Zebra Print Monitor . about the script, you can find batch file codes that works on windows 7 on how to disable/enable the printer spooler on the services.
windows server 2008 has some functions the same as windows 7.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
Windows 7 Pro 32bit
CPU
Dual Core
Antivirus
Trend Micro
What I meant about DevCon is that you first download and extract it. Assuming all computers can use the same DevCon version, you put that devcon.exe on a local server/computer that all other computers have access to. Then the first thing you do in the batch file is to copy devcon.exe from that local server to the local computer that's running the batch file. Next step in the batch file is to run the devcon command. Then distribute the batch file to all computers. When each computer then runs the batch file, devcon will automatically be copied to that computer.

DevCon is the only way I know but hopefully someone else here knows other ways to do this and will drop in to share that knowledge.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
Back
Top