Device Manager (devmgmt.msc) scripting?

I’m currently running Windows 8 and have an annoying issue where my NIC sometimes is left in a disabled state when my computer comes back from Sleep mode. I’ve tried altering Power settings and updating drivers but so far the problem keeps persisting. I’ve found that I can resolve this by going into Device Manager and either disable/enable the device or simply right-click on it and select “Scan for hardware changes”. Once it’s scanned, the device wakes up and everything is fine.

I want to automate this with a script but I can’t find info on how to do this with the command line. Does anyone have info or a link on how I could automate that, I can’t find command line options for devmgmt.msc.

Also, is there a way in Win8 to instruct it to run a batch/script when waking from sleep mode?

Thanks!

Never done it, but a quick google says you might be able to use DevCon. There’s no Win 8 support listed that I can see, but there is a Win7 version, and that will probably work.

http://social.technet.microsoft.com/wiki/contents/articles/181.how-to-manage-device-drivers-with-command-line.aspx

http://support.microsoft.com/kb/311272

Uh, good luck?

Thanks, that’s about all I was able to find as well. I’m surprised something like this isn’t possible via command line/powershell/vbscript or something, but I can’t find anything!

What is it that you want to do that DevCon doesn’t seem capable of? It looks like it can disable / enable or rescan, which is what you’re looking to do.

It looks like this is the official command line solution for doing things like that, it’s just not included in a default windows install.

Sorry if I was confusing, DevCon does indeed do what I need it to do. I was just surprised I couldn’t do it via PS/VBscript natively without a separate install.