Visual basic 2005, how to write registry key on remote computer

Posted on 2006-05-16
Last Modified: 2012-05-05

I want to write a registry key on a remote computer via a form. The form contains 2 textboxes with the values of the computer name and the value of the key that has to be written on the specific computer.

So if someone could help me with some code examples to write the remote computer's registry?
Question by:cschipper
    LVL 8

    Accepted Solution

    LVL 2

    Author Comment

    thnx for te reply, but thats a local key. I need tot change a key on a remote computer.

    I tried this:
    Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, textbox1Value).SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters", "srvcomment", textbox2Value)

    but then i get an error: {"The specified RegistryValueKind is an invalid value.
    Parameter name: valueKind"}
    LVL 8

    Expert Comment

    first u have to make sure that remote registry service is started and then u need to have access to that pc....

    if u do then u need to first connect to the pc like u would do in computer management if u right click on it...

    did u do that....meaning have u tapped into a remote registry using xp first before trying

    the other tthing is what are u trying to do...touch the registry remotely could cause severe damage...

    LVL 2

    Author Comment


    i have access to the registry remotely, i have opened regedit and i am able to connect to the remote pc.

    i am aware of the risk of touching the registry, but it's just the specific key i want to change and i know waht it's doing.
    LVL 2

    Author Comment

    I've accepted the first answer, which was a good hint and close the question.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now