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. Remote Registry editing?

Remote Registry editing?

Scheduled Pinned Locked Moved C#
csharpwindows-adminquestionannouncement
3 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

    Is it possible with c#? I'm wanting to update registry keys from one windows service.

    O 1 Reply Last reply
    0
    • J Joshua Lunsford

      Is it possible with c#? I'm wanting to update registry keys from one windows service.

      O Offline
      O Offline
      oykica
      wrote on last edited by
      #2

      It is certainly possible to use the OpenRemoteBaseKey method of the RegistryKey class in the Microsoft.Win32 namespace to read the registry on another machine but I am not sure about updating. Both machines need to be running the Remote Registry service for this to work and must have remote administration enabled.

      J 1 Reply Last reply
      0
      • O oykica

        It is certainly possible to use the OpenRemoteBaseKey method of the RegistryKey class in the Microsoft.Win32 namespace to read the registry on another machine but I am not sure about updating. Both machines need to be running the Remote Registry service for this to work and must have remote administration enabled.

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

        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 -- modified at 14:58 Friday 24th March, 2006

        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