locked
Script to Uninstall Nonpresent USB devices from device manager RRS feed

  • Question

  • Since my last thread was moved rather rudely to the group policy section (even though it's clearly about scripting), I'm trying (probably for the last time, since my last attempt went so poorly) again to get an accurate answer for my question from this forum.

    Is it possible to script the uninstallation of nonpresent USB Mass Storage devices with powershell or regular CMD commands?

    I've tried devcon.exe, and that can't remove nonpresent devices. I've tried pnputil, and that doesn't get the job done either.I've searched all over the place for an answer, and I can't find one that applies.

    This is in preparation for a GPO that will only allow certain USB drives to be installed on domain systems. THE GPO IS NOT IMPORTANT. I HAVE ALREADY WORKED THAT OUT.I just need to make sure that, once the GPO is in place, previously installed USB devices can't be used without reinstallation (thus triggering the GPO).

    I know very little about powershell and scripting in general, and would just like a little help with this problem. At the very least I need a starting point so I can create the script myself, or I need to know if this is even possible.

    I'm on Windows 7 Pro, trying to find a way to make a script that can be deployed to a larger environment that will uninstall all USB Mass Storage Devices, present and nonpresent.

    Thanks, and please don't move this thread to the GP section again, it's about scripting. If any more info is needed, please ask and I'll be happy to share what I know or can find out.

    Sam S.

    Wednesday, May 13, 2015 5:00 PM

Answers

  • Nevermind. The Anandtech Windows Software forum found the the USBDeview utility, which works perfectly for what I needed. The tool is available here:

    http://www.nirsoft.net/utils/usb_devices_view.html

    • Marked as answer by Bill_Stewart Thursday, May 14, 2015 6:49 PM
    Thursday, May 14, 2015 6:46 PM

All replies

  • No rudeness intended. The post was moved to the group policy forum because that seemed like the most appropriate place for your question.

    I would note that your question presupposes two things:

    1) That a script is the right way to accomplish what you want, and

    2) That others will take the time to research the details of this problem on your behalf.

    Here's the script request form, as it seems that you really have a script request rather than a scripting question:

    https://gallery.technet.microsoft.com/scriptcenter/site/requests


    -- Bill Stewart [Bill_Stewart]

    Wednesday, May 13, 2015 6:33 PM
  • Nevermind. The Anandtech Windows Software forum found the the USBDeview utility, which works perfectly for what I needed. The tool is available here:

    http://www.nirsoft.net/utils/usb_devices_view.html

    • Marked as answer by Bill_Stewart Thursday, May 14, 2015 6:49 PM
    Thursday, May 14, 2015 6:46 PM