ConnectionOptions oConn = new ConnectionOptions(); System.Management.ManagementScope scope = new System.Management.ManagementScope(@"\\" +hostname + @"\root\cimv2", oConn); scope.Connect(); ManagementClass registry = new ManagementClass(scope, new ManagementPath("StdRegProv"), null); ManagementBaseObject inParams = registry.GetMethodParameters("GetStringValue"); inParams["sSubKeyName"] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\.NETFramework"; inParams["sValueName"] = "InstallRoot"; ManagementBaseObject outParams = registry.InvokeMethod("GetStringValue", inParams, null); if (outParams.Properties["sValue"].Value != null) { output = outParams.Properties["sValue"].Value.ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)