05 Mar
Posted by Jayce Ooi as How to, Programming
How to read and write Windows System Registry Keys and Values? I need to create a value at Windows System Registry for my project lately. It is used for SCOM discovery. I need a Windows System Registry key to determine that the server is the server that SCOM going to monitor.
First thing to do in your C#. Add using Microsoft.Win32; RegistryKey and Registry requires Microsoft.Win32 as the assembly reference.
Here are the codes that write Windows System Registry Keys.
RegistryKey JayceOoiKey = Registry.LocalMachine.CreateSubKey(“SOFTWARE\\JayceOoi”);
This will create key JayceOoi under HKEY_LOCAL_MACHINE\SOFTWARE\.
To read Test string value from HKEY_LOCAL_MACHINE\SOFTWARE\JayceOoi\
string Output = JayceOoiKey.GetValue(“Test”);
These are the methods that I use to read and write Windows System Registry Keys and Values. Hope it will help in your programming work.
Tags: HKEY_LOCAL_MACHINE, key, Microsoft, Programming, read, Registry, RegistryKey, SCOM, Software, value, Win32, Windows, Windows System, Windows System Registry, write
This is by far THE worst reg tut I ever seen!
I have to agree!!!!