Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7433585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:41:41+00:00 2026-05-29T09:41:41+00:00

How do I add a new key in the registry of other users using

  • 0

How do I add a new key in the registry of other users using c# (or c/c++ or other language)

here is the scenario:
Client PC: “Administrator” account(logged in)

“User A” and “User B” can login on the Client PC only through a domain “myDomain” (they have already logged on once and have their own folder in user of the Client PC)

so I will run this code to create a new key using administrator

Registry.CurrentUser.CreateSubKey(@”SOFTWARE\myProgram\DefaultConfig”);

but the problem is, this key is only created for the “Administrator” account

I want to create this key for “User A” and “User B” too while still using “Administrator” account

both “User A” and “User B” does not appear in the HKEY_USERS

And is if there are more users in the same PC I want to add this registry key to them also is it possible to loop a code that adds a key for all users? Read and write loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:41:42+00:00Added an answer on May 29, 2026 at 9:41 am

    Keys for all users are stored under the HKEY_USERS root key. Under this root key, there is a key for every user which has its SID as key name.

    You’ll have to get the SID of the desired user, then access to this root key:

    // Gets the SID of the desired user
    NTAccount f = new NTAccount(userName);
    SecurityIdentifier s = (SecurityIdentifier)f.Translate(typeof(SecurityIdentifier));
    string sid = s.ToString();
    
    // Now you can access to the HKEY_USERS root key
    string path = @"SOFTWARE\Console\DefaultConfig";
    Registry.Users.CreateSubKey(string.Format("{0}\\{1}", sid, path));
    

    But honestly, I’m not sure it’s a very good idea. Couldn’t you use Registry.LocalMachine instead, which applies to all users?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to test Add new item activity in my application. When user fills
When I remove Dictionary key add then add new key to dictionary new value
I have the following code that I have tested and works: using (new Impersonator(Administrator,
i have a winform datagridview: DataTable table = new DataTable(); table.Columns.Add(Check, typeof(bool)); table.Columns.Add(User, typeof(string));
How do I add a new key to an existing dictionary? It doesn't have
How can I add a new key/value pair to an existing array inside of
I have the following code: MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control)); I need to add another gesure
I use the following statement to index a date: luceneDoc.add(new NumericField(key).setLongValue(date.getTime())); I also use
Is there any way by which I can add the new key-value pairs to
I'm adding a self-signed X509 Certificate to an HTTPS request. request.ClientCertificates.Add(new X509Certificate(@key.pfx, )); It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.