locked
how to change permissions on a registry key

    คำถาม

  • 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

    4 พฤษภาคม 2555 16:20

ตอบทั้งหมด

  • 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
    5 พฤษภาคม 2555 12:03
  • 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

    5 พฤษภาคม 2555 12:09
  • 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
    5 พฤษภาคม 2555 12:15
  • 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

    5 พฤษภาคม 2555 12:19
  • 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

    6 พฤษภาคม 2555 3:03
  • 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

    6 พฤษภาคม 2555 10:55
  • 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
    6 พฤษภาคม 2555 11:07
  • 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

    6 พฤษภาคม 2555 11:09
  • 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
    6 พฤษภาคม 2555 11:16
  • 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

    6 พฤษภาคม 2555 11:21
  • 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

    6 พฤษภาคม 2555 16:29
  • if you then know a way to change permissions on the required key for that SID then yes

    Darren Rose

    7 พฤษภาคม 2555 12:14
  • 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.

    8 พฤษภาคม 2555 15:28
    ผู้ดูแล
  • 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

    8 พฤษภาคม 2555 15:33
  • 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

    8 พฤษภาคม 2555 18:26
  • 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

    9 พฤษภาคม 2555 14:50
  • 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.

    16 พฤษภาคม 2555 12:51