I can’t get REG_DWORD data from USBSTOR registry key, but I can get ‘DisplayName’ data of REG_SZ type
ManagementScope myScope = new ManagementScope("\\\\" + strComputer + "\\root\\default");
ManagementPath mypath = new ManagementPath("StdRegProv");
ManagementClass mc = new ManagementClass(myScope, mypath, null);
ManagementBaseObject inParams = mc.GetMethodParameters("GetStringValue");
inParams["sSubKeyName"] = @"SYSTEM\CurrentControlSet\services\USBSTOR";
inParams["sValueName"] = "DisplayName";
ManagementBaseObject outParams = mc.InvokeMethod("GetStringValue", inParams, null);
Console.WriteLine(outParams["Type"].ToString());
You should use the GetDWORDValue method if data type is REG_DWORD and GetStringValue method if data type is REG_SZ: