@Nevin Sunny, Welcome to Microsoft Q&A, you could try to use Devcon.exe to Enable and Disable USB devices without rebooting.
Here are some steps you could refer to.
First, please install the WDK from the following link:
Download the Windows Driver Kit (WDK)
Usually is found in C:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe
Second, you could find the USB Hardware device ID from Device Manager-USB Device->Properties ->Details->Hardware IDs
Third, you could use the following c# code to call devcon.exe.
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
string devconPath = @"C:\Path\To\devcon.exe"; // Replace with actual path
string hardwareId = "USB\\VID_1234&PID_5678"; // Your USB device ID
// Disable the USB device
ExecuteDevcon(devconPath, "disable", hardwareId);
Console.WriteLine("USB device disabled!");
// Wait for 3 seconds, then enable it again
System.Threading.Thread.Sleep(3000);
ExecuteDevcon(devconPath, "enable", hardwareId);
Console.WriteLine("USB device enabled!");
}
static void ExecuteDevcon(string devconPath, string command, string hardwareId)
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = devconPath,
Arguments = $"{command} \"{hardwareId}\"",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
};
using (Process process = new Process { StartInfo = psi })
{
process.Start();
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
process.WaitForExit();
Console.WriteLine(output);
if (!string.IsNullOrEmpty(error))
{
Console.WriteLine("Error: " + error);
}
}
}
}
Based on my test, I could use the above code to enable or disable USB devices successfully without rebooting the system.
Hope my advice could help you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.