<p>Is there any way to disable a system device from C#.NET.</p>

<p>Basically emulating when you go to Device Manager and disable a device that way?</p>

<p>I am assuming there is a WinAPI function that I can invoke, but I don't know which one it is?</p>

<p>The reason I need to do this is that I need to disable and straight after enable the device again.</p>

<p>I need to work in Windows XP and Vista (x86 &amp; x64). I had a look at something called "DevCon" but it doesn't seem to work on Vista x64.</p>

<p>Thanks.</p>

<p><strong>For the answer see here: <a href="https://stackoverflow.com/questions/4097000/how-do-i-disable-a-system-device-programatically">How do I disable a system device programatically?</a></strong></p>

To futher Mel Green's answer, the hardware helper library uses interop to call the Windows API (setupapi), specifically the SetupDiSetClassInstallParams method. Of course there are other calls here which are used to look up the device details etc.
One thing to consider that if you are running as a standard user or unprivileged account you will not be able to use this to control (enable/disable etc) hardware devices.
For more details have a look at
http://www.pinvoke.net
(and for the specific call:
http://pinvoke.net/default.aspx/setupapi.SetupDiSetClassInstallParam
)