Can hardware be enabled / disabled programmatically?
2 answers
As per the answers in this thread of discussion , USB ports can be disabled by modifying a registry key. You can do it in C #.
In general, this is actually a Windows hardware issue, not a C # issue. C # does not have any special access or hardware control - anything you want to do in C # must be done using the Windows API or configuration tools. Almost any unmanaged Windows API can be called from managed .NET code (C # or otherwise) using .NET PInvoke.
+3
source to share
Snapshot in the dark here, if you can write a separate * .exe file or something like that, you can call the * .exe file in C # code.
Checkout System.Diagnostics.Process API.
System.Diagnostics.Processp = new Systems.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "cmd";
p.StartInfo.Arguments = "..."; // Your command and args here
p.StartInfo.RedirectStandartOutput = true;
p.Start();
p.WaitForExit();
Good luck!
-1
source to share