Expanded Remote Registry Editing Issues
-
Having issues find solution in for Remote Registry editing. Yeah i got the remote viewing under control... With remote editing, I can do it with VBscript easy:
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") objReg.SetStringValue HKEY_LOCAL_MACHINE,strPointerKey,strPointerEntry,strPointerValue objReg.CreateKey HKEY_LOCAL_MACHINE,strMyKey
surely .NET can do it. this is what i tried:RegistryKey LM = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,WSID); RegistryKey inventoryKeys = LM.OpenSubKey("SOFTWARE\\CompanyName\\AppName"); inventoryKeys.SetValue("ValueName","Value");
and the error message is: Get REG values: System.UnauthorizedAccessException: Cannot write to the registry key. at Microsoft.Win32.RegistryKey.ValidateState(Boolean needWrite) at Microsoft.Win32.RegistryKey.SetValue(String name, Object value) at testReg.Class1.update() in c:\projects\testreg\class1.cs:line 48: 03/24/20 06 02:41:01 PM -
Having issues find solution in for Remote Registry editing. Yeah i got the remote viewing under control... With remote editing, I can do it with VBscript easy:
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") objReg.SetStringValue HKEY_LOCAL_MACHINE,strPointerKey,strPointerEntry,strPointerValue objReg.CreateKey HKEY_LOCAL_MACHINE,strMyKey
surely .NET can do it. this is what i tried:RegistryKey LM = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,WSID); RegistryKey inventoryKeys = LM.OpenSubKey("SOFTWARE\\CompanyName\\AppName"); inventoryKeys.SetValue("ValueName","Value");
and the error message is: Get REG values: System.UnauthorizedAccessException: Cannot write to the registry key. at Microsoft.Win32.RegistryKey.ValidateState(Boolean needWrite) at Microsoft.Win32.RegistryKey.SetValue(String name, Object value) at testReg.Class1.update() in c:\projects\testreg\class1.cs:line 48: 03/24/20 06 02:41:01 PMI thought the error was pretty clear. The account your code in running under (probably yours) doesn't have write permissions to the key you opened. Are you running in a domain environment? Does the account you're using have Administrator rights to the remote machine? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
I thought the error was pretty clear. The account your code in running under (probably yours) doesn't have write permissions to the key you opened. Are you running in a domain environment? Does the account you're using have Administrator rights to the remote machine? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave Kreskowiak wrote:
Are you running in a domain environment? Does the account you're using have Administrator rights to the remote machine?
Yes. Yes.
-
Dave Kreskowiak wrote:
Are you running in a domain environment? Does the account you're using have Administrator rights to the remote machine?
Yes. Yes.
Then the only other possibilities that I can think of (in my currently grogy state) is that either the key path doesn't exist or the ACL permissions on that key are restricting access to it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome