Thanks for the detailed information. I'm actually on XP. I may have confused you because I forgot and left out a step; in the hardware tab of the system control panel I click on another button -- 'Device Manager', I think, but I'm on a Mac system right now so I'm still going from memory. I'm interested in a solution that will work on Win2k and above since that is the range of OS's that our software supports.

I'm writing a set of tests for our software to see how it behaves when a USB security hasp is removed/not present. Our software is only supposed to work when the hasp is present.

In doing some more digging around on the internet I found an MSDN article that pointed to a command line utility, devcon, that does most of what the Device Manager control panel does, but from the command line. It can be downloaded here. Should be straightforward to write a perl wrapper around that, much easier than trying to muck with WMI. Curious, though in doing some reading on WMI, my impression was that it was only useful for querying information about the system setup. It didn't seem to me that you could use it to effect changes to the system configuration.

Update: Just noticed that devcon.exe is part of the DDK package you mentioned.

Update: The x64/amd64 version of this tool is not included in the link I mentioned above. It's only available, afaict, as part of the newer Windows Driver Kit.

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."


In reply to Re^4: How do you enable/disable a driver in Windows? by DrWhy
in thread How do you enable/disable a driver in Windows? by DrWhy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.