node-activex
node-activex copied to clipboard
Reading Registry with WbemScripting.SWbemLocator not working
Is it possible to replicate Registry Parse with "WbemScripting.SWbemLocator", Reading List of Values ? keep up the great work, this lib is awesome!
example: https://www.dostips.com/forum/viewtopic.php?t=7347&start=30
var vRet = null, iType = -1; var objLocator = new ActiveXObject("WbemScripting.SWbemLocator"); var objService = objLocator.ConnectServer(strComputer, "root\default"); objService.Security_.ImpersonationLevel = 3; //wbemImpersonationLevelImpersonate var objReg = objService.Get("StdRegProv"); var objEnumMethod = objReg.Methods_.Item("EnumValues"); var objEnumInParam = objEnumMethod.InParameters.SpawnInstance_(); objEnumInParam.hDefKey = uHive; objEnumInParam.sSubKeyName = strRegPath; var objEnumOutParam = objReg.ExecMethod_(objEnumMethod.Name, objEnumInParam);
var objGetMethod = objReg.Methods_.Item("GetExpandedStringValue"); var objGetInParam = objGetMethod.InParameters.SpawnInstance_(); objGetInParam.hDefKey = uHive; objGetInParam.sSubKeyName = strRegPath; objGetInParam.sValueName = strValName; var objGetOutParam = objReg.ExecMethod_(objGetMethod.Name, objGetInParam);
i`m tested sucessfully, try
var objLocator = new winax.Object("WbemScripting.SWbemLocator");
var objService = objLocator.ConnectServer(".", "root\\default");
objService.Security_.ImpersonationLevel = 3; //wbemImpersonationLevelImpersonate
var objReg = objService.Get("StdRegProv");
var objGetMethod = objReg.Methods_.Item("GetExpandedStringValue");
var objGetInParam = objGetMethod.InParameters.SpawnInstance_();
objGetInParam.hDefKey = 0x80000001; //HKCU;
objGetInParam.sSubKeyName = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes";
objGetInParam.sValueName = "CurrentTheme";
var objGetOutParam = objReg.ExecMethod_(objGetMethod.Name, objGetInParam);
console.log('CurrentTheme: ', objGetOutParam.sValue.valueOf());
may be not enough backslash "root\default"?
great! I'll test just that... Thanks!
awesome lib.
ok, close this Issue, It's working just fine. thx.