Sign in to follow this  
Followers 0
tazdev

Registry Permissions settings

13 posts in this topic

Is there a way to change the permissions on a key? I tried to export the key from the registry but the .reg file doesn't note what the security settings are. Basically I want HKEY_LOCAL_MACHINE\blahblahblah\blah to allow Users full control over that part of the registry. I see RegWrite so I know that would be what I would use to write it but does anyone know how to export the settings to a reg file to be imported into the registry?

I am looking for something other than actually calling up regedt32 and changing it.

I assume I can import the key, then have AutoIT open the regedt32, go to the key, mouse click it then mouse click the Security Menu, then Permissions, then wait for the Dialoge box, click users, click Full Control, Press OK, Close regedt32, logoff.

Share this post


Link to post
Share on other sites



NM regperm will do it. Run that in AutoIt to account for the switches you need and BAM

Share this post


Link to post
Share on other sites

Is there a way to change the permissions on a key? I tried to export the key from the registry but the .reg file doesn't note what the security settings are. Basically I want HKEY_LOCAL_MACHINE\blahblahblah\blah to allow Users full control over that part of the registry. I see RegWrite so I know that would be what I would use to write it but does anyone know how to export the settings to a reg file to be imported into the registry?

I am looking for something other than actually calling up regedt32 and changing it.

I assume I can import the key, then have AutoIT open the regedt32, go to the key, mouse click it then mouse click the Security Menu, then Permissions, then wait for the Dialoge box, click users, click Full Control, Press OK, Close regedt32, logoff.

<{POST_SNAPBACK}>

i am using SetAcl for that....

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Now $pcname = PCName specified by user

regperm.exe is in the C:\i386 I even put in a sleep(100) to make sure it copied over fine first.

When I run it I get runwait(@comspec "/c" & "C:\i386\REGPERM.EXE /K HKEY_LOCAL_MACHINE\Software\bbb \\" & $pcname & " /A:Users:F /E")

Error: Unable to execute the external program

The system cannot find the path specified

Now if I open a CMD window and type in the command with the PC's name instead of $pcname the program works with no problem but if in the script it doesn't.

edit: It isn't that I don't want to try SetACL. I was given this tool to use first so if I can get it to work then good. If not I will look at SetACL.

runwait(@comspec  "/c" & "C:\i386\REGPERM.EXE  /K HKEY_LOCAL_MACHINE\Software\bbb \\" & $pcname & "  /A:Users:F  /E")
Edited by tazdev

Share this post


Link to post
Share on other sites

You are missing spaces around /c...

runwait(@comspec  " /c C:\i386\REGPERM.EXE  /K HKEY_LOCAL_MACHINE\Software\bbb \\" & $pcname & "  /A:Users:F  /E")

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You are missing spaces around /c...

runwait(@comspec  " /c C:\i386\REGPERM.EXE  /K HKEY_LOCAL_MACHINE\Software\bbb \\" & $pcname & "  /A:Users:F  /E")

<{POST_SNAPBACK}>

Oh my god

I am a moron!!!

Everyone, join in,

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA

:lmao:o:):):):):whistle::huh2::P:P

Edited by tazdev

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

So with SetACL I would need to put:

SetACL.exe -on "hklm\software\bbb" -ot reg -actn ace

-ace "n:$pcname\users;p:full"

where bbb is the key under software and $pcname is the PCname if I want it to be local not domain?

Is it then:

edit:

RunWait (@comspec " /c " & 'c:\i386\SetACL.exe -on "\\" & $pcname & "hklm\software\bbb" -ot reg -actn ace -ace "n:' & $pcname & '\users;p:full"')

???

The regperm thing didn't work. Dunno why but oh well.

Edited by tazdev

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

aren't you are missing a backslash? :

"" & $pcname & "\hklm\software\bbb"

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This should work.

If it doesn't check the documentation from the program.

It could be that you need to put 2 backslashes in front of the last $pcname

RunWait(@comspec ' /c c:\i386\SetACL.exe -on \\' & $pcname & '\hklm\software\bbb -ot reg -actn ace -ace "n:' & $pcname & '\users;p:full"')

Share this post


Link to post
Share on other sites

Yep that worked.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

One more method, using built in Windows utility "RegINI"

Manual - http://support.microsoft.com/kb/245031/en-us or use "regini /?" in console.

Code of script is very simple:

RunWait("regini " & @ScriptDir & "Permissions.txt")

Code of Permissions.txt is very simple too:

RegistryMachineSOFTWARE1CTradeWare [1 5 7 17]
RegistryMachineSOFTWARE1CTradeWareScanOPOS [1 5 7 17]

In this case the "RegistryMachineSOFTWARE1CTradeWare" equals HKLMSOFTWARE1CTradeWare

And numbers in "[]" is the following permissions:

1 - Administrators Full Access

5 - Creator Full Access

7 - World Full Access

17 - System Full Access

Edited by newchel

Share this post


Link to post
Share on other sites

Just an FYI, this thread is over 5 1/2 years old, please don't necropost to something this old. Thanks.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0