windows - Cannot read registry key when using SRVANY -
i working on script needs read , write value hklm registry hive. while works fine when running script, registry access denied when running same code service using srvany utility. service created using srvany runs under local system context belive should have full access hklm registry hive. when running code script, running under administrator account.
reg_key_path = "hklm\software\appname\serviceconfig" strfilename = objwshshell.regread(reg_key_path)
the error above code
invalid root in registry key "hklm\software\appname\serviceconfig"
the trick use "c:\windows\sysnative\cscript.exe" launch cscript via srvany. full credit hans passant answer.
Comments
Post a Comment