locked
how to change permissions on a registry key

    Question

  • Hi

    I am trying to change the permisions of the following registry key from within VB.net:-

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing

    Basically need to change users to full control (rather than the default of read)

    Have read through forum, and replies to a previous post I made (n.b. have started a new one as that post covered various things and was getting a bit convulted) and lots of links but still cannot work out how to do it, please can someone help me further?


    Darren Rose

    Friday, May 04, 2012 4:20 PM

All replies

  • All keys work the same.  You need to run a program with sufficient priveledges (permissions) to do any act, just as a user would need sufficient permisions to do the same act.  Was your program running with sufficient priveledges?

    --
    Mike
    Saturday, May 05, 2012 12:03 PM
  • All keys work the same.  You need to run a program with sufficient priveledges (permissions) to do any act, just as a user would need sufficient permisions to do the same act.  Was your program running with sufficient priveledges?

    --
    Mike

    Yes I am quite aware all keys work the same - and yes the app runs with admin permissions

    It is the coding to make the change I am struggling with as per my message


    Darren Rose

    Saturday, May 05, 2012 12:09 PM
  • Code similar to the examples here is what I have always used.  If something similar is not working in your scenario, what is the error message?

    --
    Mike
    Saturday, May 05, 2012 12:15 PM
  • Code similar to the examples here is what I have always used.  If something similar is not working in your scenario, what is the error message?

    --
    Mike

    Yes I read that code - but how to get it to make the change for the "users" group rather than just the current user?

    Darren Rose

    Saturday, May 05, 2012 12:19 PM
  • From Microsoft.Win32:

    Registry.CurrentConfig.OpenSubKey("Name", RegistryKeyPermissionCheck.ReadWriteSubTree)

    User's group? Why doesn't it suffice for being changed for the current user? You can define your Registry hive and open a subkey with read/write permissions this way.


    If a post helps you in any way or solves your particular issue, please remember to use the Propose As Answer option or Vote As Helpful
    Visit the Forum: TechLifeForum

    Sunday, May 06, 2012 3:03 AM
  • From Microsoft.Win32:

    Registry.CurrentConfig.OpenSubKey("Name", RegistryKeyPermissionCheck.ReadWriteSubTree)

    User's group? Why doesn't it suffice for being changed for the current user? You can define your Registry hive and open a subkey with read/write permissions this way.


    If a post helps you in any way or solves your particular issue, please remember to use the Propose As Answer option or Vote As Helpful
    Visit the Forum: TechLifeForum

    beacause the change need to affect any user who logs on to the computer not just the currently logged on one - hence why it needs to be for the users group

    Darren Rose

    Sunday, May 06, 2012 10:55 AM
  • I suspect that what AceInfinity is saying is, why does it not need to be anyone running your app?  You would check and change this at the point you need it.

    --
    Mike
    Sunday, May 06, 2012 11:07 AM
  • The app is used to "prep" new computers - a new image is applied to a computer, then this app is run which allows you to change various settings and change computer name etc etc - so that the PC is ready to be deployed to the user - at the time the app is run it is not joined to the domain and is logged on with a local admin account

    It need to be for the "users" group so that when it is connected to domain and a user logs on that he gets this setting - make sense now?

    Not really sure why it needs to be done is that important - my problem is how to do it


    Darren Rose

    Sunday, May 06, 2012 11:09 AM
  • Now I see.  Well, I don't know how to change it for all users, so I am sorry, I cannot help you there.
     
    If I were faced with what you described, I would change the settings prior to imaging.  There may be a good reason that you cannot do this, hence the need for your prep app.  I don't know a solution for that though.  Sorry, hopefully someone does.

    --
    Mike
    Sunday, May 06, 2012 11:16 AM
  • Now I see.  Well, I don't know how to change it for all users, so I am sorry, I cannot help you there.
    If I were faced with what you described, I would change the settings prior to imaging.  There may be a good reason that you cannot do this, hence the need for your prep app.  I don't know a solution for that though.  Sorry, hopefully someone does.

    --
    Mike

    Thanks for replying - unfortunately you can't do it on the image, as after sysprep runs it changes it back

    Darren Rose

    Sunday, May 06, 2012 11:21 AM
  • It need to be for the "users" group so that when it is connected to domain and a user logs on that he gets this setting - make sense now?

    Would it help if you knew the SID for the Users group?

    --
    Andrew

    Sunday, May 06, 2012 4:29 PM
  • if you then know a way to change permissions on the required key for that SID then yes

    Darren Rose

    Monday, May 07, 2012 12:14 PM
  • Hi Darren,

    How about this KB: http://support.microsoft.com/kb/154599 

    1. Open Registry Editor and navigate to:

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion \ProfileList
    2. Under the ProfileList key, you will see the SIDs. By selecting each one individually, you can look at the value entry and see what user name is associated with that particular SID.

    So when you want to search a SID for an username, you can traverse this registry key.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 08, 2012 3:28 PM
  • Thanks - will take a look - but not sure it will help me as it needs to be set for the "users" group rather than a specific user


    Darren Rose

    Tuesday, May 08, 2012 3:33 PM
  • if you then know a way to change permissions on the required key for that SID then yes

    Without testing (as I don't want any chance of messing up the registry on my computer), the example here but using BUILTIN\USERS as the user looks to have what you're after.

    HTH,

    Andrew

    Tuesday, May 08, 2012 6:26 PM
  • if you then know a way to change permissions on the required key for that SID then yes

    Without testing (as I don't want any chance of messing up the registry on my computer), the example here but using BUILTIN\USERS as the user looks to have what you're after.

    HTH,

    Andrew

    Thanks - now taking a look - but had already seen this code - but couldn't work out how to change it to use builtin\users group?

    Darren Rose

    Wednesday, May 09, 2012 2:50 PM
  • Hi Darren,

    Do you still work on this issue?

    I don't think Builtin is  a specific group. Please try your own method.

    Have a nice day.


    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Wednesday, May 16, 2012 12:51 PM