how to change permissions on a registry key
-
4. května 2012 16:20
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
Všechny reakce
-
5. května 2012 12:03
-
5. května 2012 12:09All 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?
--
MikeYes 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. května 2012 12:15Code 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. května 2012 12:19Code 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
-
6. května 2012 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 -
6. května 2012 10:55
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 groupFrom 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: TechLifeForumDarren Rose
-
6. května 2012 11:07
-
6. května 2012 11:09
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. května 2012 11:16Now 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. května 2012 11:21Now 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 backDarren Rose
-
6. května 2012 16:29
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 -
7. května 2012 12:14if you then know a way to change permissions on the required key for that SID then yes
Darren Rose
-
8. května 2012 15:28Moderátor
Hi Darren,
How about this KB: http://support.microsoft.com/kb/154599
- Open Registry Editor and navigate to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion \ProfileList - 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.
- Open Registry Editor and navigate to:
-
8. května 2012 15:33
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. května 2012 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
-
9. května 2012 14:50
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?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
Darren Rose
-
16. května 2012 12:51
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.