troubleshooting Question

How to edit registry files like "software"

Avatar of LIBRALEX
LIBRALEXFlag for South Africa asked on
SecurityWindows NetworkingVisual Basic.NETPowershellMicrosoft Visual Studio
11 Comments1 Solution117 ViewsLast Modified:
Is there a way to edit the security registry (HKLM:\SOFTWARE\Microsoft\MSDTC\Security) programmatically in vb.net?

I have tried the following to test but it does not seem to work.
This is an example of the NetworkDtcAccess registry.

Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\MSDTC\Security", True)
regKey.SetValue("NetworkDtcAccess", 1)

I am running visual studio as administrator and I am the administrator of the computer

I had a suggest of running the commands as a powershell script but that bring up a lot of unnecessary problems to overcome in the code. So I tested and found if you run the command one by one it works. I I tried to apply this in visual studio, it does not give me any errors but the changes is not applied. I don't know if windows is blocking me. Here is the example.

        Dim objProcess As New System.Diagnostics.Process()
        Dim startInfo As System.Diagnostics.ProcessStartInfo = New ProcessStartInfo

        startInfo.FileName = "powershell.exe"
        startInfo.Arguments = "Set-ItemProperty -Path
        HKLM:\SOFTWARE\Microsoft\MSDTC\Security -Name NetworkDtcAccess -Value 1 -ErrorAction
        Stop"
        startInfo.RedirectStandardOutput = True
        startInfo.RedirectStandardError = True
        startInfo.UseShellExecute = False
        startInfo.CreateNoWindow = False
        objProcess.StartInfo = startInfo
        objProcess.Start()

        Dim output As String = objProcess.StandardOutput.ReadToEnd()
        Dim errors As String = objProcess.StandardError.ReadToEnd()

        objProcess.Close()

Is it possible to edit the security registry in windows?

Regards
Libralex
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros