S
SharePoint2016
Guest
Hello All,
I writing C# code to pull the names of the browsers and their versions from remote desktops as shown below. I am partially successful and I am getting the browser names. However, I need help to pull the browser versions. Please help.
ManagementPath mypath = new ManagementPath("StdRegProv");
ManagementClass wmiRegistry = new ManagementClass(scope, mypath, null);
const uint HKEY_LOCAL_MACHINE = unchecked((uint)0x80000002);
string keyPath = @"SOFTWARE\WOW6432Node\Clients\StartMenuInternet";
object[] methodArgs = new object[] { HKEY_LOCAL_MACHINE, keyPath, null };
uint returnValue = (uint)wmiRegistry.InvokeMethod("EnumKey", methodArgs);
if (null != methodArgs[2])
{
string[] subKeys = methodArgs[2] as String[];
if (subKeys == null) return;
ManagementBaseObject inParams = wmiRegistry.GetMethodParameters("GetStringValue");
inParams["hDefKey"] = HKEY_LOCAL_MACHINE;
inParams["sSubKeyName"] = keyPath;
string keyName = "";
foreach (string subKey in subKeys)
{
if (subKey == "FIREFOX.EXE")
{
keyName += "Firefox" + " | ";
}
else if (subKey == "IEXPLORE.EXE")
{
keyName += "Internet Explorer" + " | ";
}
else
{
keyName += subKey + " | ";
}
}
Console.WriteLine(keyName.Length-2);
Knowledge is power.Information is wealth.
Continue reading...
I writing C# code to pull the names of the browsers and their versions from remote desktops as shown below. I am partially successful and I am getting the browser names. However, I need help to pull the browser versions. Please help.
ManagementPath mypath = new ManagementPath("StdRegProv");
ManagementClass wmiRegistry = new ManagementClass(scope, mypath, null);
const uint HKEY_LOCAL_MACHINE = unchecked((uint)0x80000002);
string keyPath = @"SOFTWARE\WOW6432Node\Clients\StartMenuInternet";
object[] methodArgs = new object[] { HKEY_LOCAL_MACHINE, keyPath, null };
uint returnValue = (uint)wmiRegistry.InvokeMethod("EnumKey", methodArgs);
if (null != methodArgs[2])
{
string[] subKeys = methodArgs[2] as String[];
if (subKeys == null) return;
ManagementBaseObject inParams = wmiRegistry.GetMethodParameters("GetStringValue");
inParams["hDefKey"] = HKEY_LOCAL_MACHINE;
inParams["sSubKeyName"] = keyPath;
string keyName = "";
foreach (string subKey in subKeys)
{
if (subKey == "FIREFOX.EXE")
{
keyName += "Firefox" + " | ";
}
else if (subKey == "IEXPLORE.EXE")
{
keyName += "Internet Explorer" + " | ";
}
else
{
keyName += subKey + " | ";
}
}
Console.WriteLine(keyName.Length-2);
Knowledge is power.Information is wealth.
Continue reading...