Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Expanded Remote Registry Editing Issues

Expanded Remote Registry Editing Issues

Scheduled Pinned Locked Moved C#
csharpwindows-adminhelpannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joshua Lunsford
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • J Joshua Lunsford

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        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

        J Offline
        J Offline
        Joshua Lunsford
        wrote on last edited by
        #3

        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.

        D 1 Reply Last reply
        0
        • J Joshua Lunsford

          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.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups