Sign in to follow this  
Followers 0
Guest TheAncient

RegDelete and registry permissions

17 posts in this topic

I am trying to delete a registry key as an administrator but its got permissions that wont allow admin to delete it. Using RegEdit it can not be deleted. Using Regedt32 the permissions can be changed and the key deleted. Is there anyway to script this permissions change within autoit v3? This would save me ohhhh so much time from machine to machine.

Share this post


Link to post
Share on other sites



Thank you for the reply, however this does not answer my question. The registry entries I want to delete have permissions that dont allow Administrator to delete them. However the Administrator does have the rights to change the rights on the key so that it can be deleted. From Regedt32 you can change the permissions on the key and then its deletable. I want to automate this change in permissions so that I can use RegDelete.

From doing some googling I see that the command regini.exe may allow me to script it, but I will have to include regini.exe along with my AutoIt script. This is doable but not optimal. :ph34r:

See the remarks:

RegDelete

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

Optimal all depends on if regini.exe has to install dlls or if it is a stand alone program.

I am taking it you will be running Regedt32 from the run command line?

If that is the case...

Send("#r")
WinWaitActive("Run")
Send("Regedt32{Enter}")

Now you have that open. Next you need to do some detective work with AutoIt's very own WindowSpy. Check the control names of the buttons you need to click and start scripting. I would recommend you come back with some code... let us know how it isnt performing right and we will try to fix it for you. I do believe the help file contains much useful information on how to manipulate a program while you have it open.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

If that is the case...

Send("#r")
WinWaitActive("Run")
Send("Regedt32{Enter}")

Now you have that open. Next you need to do some detective work with AutoIt's very own WindowSpy. Check the control names of the buttons you need to click and start scripting. I would recommend you come back with some code... let us know how it isnt performing right and we will try to fix it for you. I do believe the help file contains much useful information on how to manipulate a program while you have it open.

JS

<{POST_SNAPBACK}>

Yeah, "this is doable but not optimal." :(

I think that, "RegIni.exe" it's better method between both cases.

The registry entries I want to delete have permissions that dont allow Administrator to delete them.

...it seems like a limitation... :ph34r:

Share this post


Link to post
Share on other sites

Send("#r")
WinWaitActive("Run")
Send("Regedt32{Enter}")

<{POST_SNAPBACK}>

Just have to say, this is the worst way to run a program. This is what Run() is for.

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Hrm... true but that requires knowing where the file is :-P

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Ok, for now I am calling this program to recursively change the permissions on the keys I want to delete. Works great so far. Its opensource too! :ph34r:

http://setacl.sourceforge.net

Share this post


Link to post
Share on other sites

Hrm... true but that requires knowing where the file is :-P

JS

<{POST_SNAPBACK}>

And you think that using the Run Dialog doesn't? Both of them look in the same environment variable (PATH) to locate applications. If you can use the Run Dialog to run it, then you can use Run() to run it equally as well.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

And you think that using the Run Dialog doesn't?  Both of them look in the same environment variable (PATH) to locate applications.  If you can use the Run Dialog to run it, then you can use Run() to run it equally as well.

<{POST_SNAPBACK}>

Okay okay hehe.

JS

Edit: Since we are on the Run() subject... can I get a bit of help?

This is my code...

$url = "http://www.familychristianacademy.com/admin"
Run(@ComSpec & " /c start " & $url,'',@SW_MAXIMIZE)

The window doesnt maximize...

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Okay okay hehe.

JS

Edit: Since we are on the Run() subject... can I get a bit of help?

This is my code...

$url = "http://www.familychristianacademy.com/admin"
Run(@ComSpec & " /c start " & $url,'',@SW_MAXIMIZE)

The window doesnt maximize...

JS

<{POST_SNAPBACK}>

That's 'cause you're telling the command window to maximize, not start...

go to the command prompt, and type start /? that will give you command line options for your OS and the start command....

btw, here's how I did it for access:

$ACCESSPATH = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msaccess.exe", "")
run('"' & $accesspath & '" "' & $myDB & '"')

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

See sugi's post below, his has correct information.

Edited by Valik

Share this post


Link to post
Share on other sites

You can run anything without issue with the exception of things located in:

Or whatever the equivalent to that directory is.  For some reason, the run dialog looks there, too, even though its not defined on the path anywhere.

<{POST_SNAPBACK}>

That's simply wrong. The Run dialog does NOT check the directory you mentioned. It checks the registry.

The Run Dialog does exactly the same as cmd /c start ... which means:

1. check current directory

2. check %PATH%

3. check if windows already knows where to find the app (registry: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths)

4. check if it's a protocoll (means: begins like http://, ftp://, hcp://, ...) and passes it to the correct file protocol handler

5. check if it's a document and then runs the correct program that's associated with the document type.

The Run() function only does the first two checks. This is why Run() cannot open programs that are not within the path or current directory and is unable to handle protocols and documents.

Share this post


Link to post
Share on other sites

Nice, thank you. That looks like another good program to use. Though I dont see any licensing info.

SetACL works on files and has other functions too, so for now I think I will stick with that. And its GPL so I know I can distribute it without issue.

Maybe you could also use "RegPerm" before:

http://homepages.cae.wisc.edu/~micro/regperm/

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

That's 'cause you're telling the command window to maximize, not start...

go to the command prompt, and type start /? that will give you command line options for your OS and the start command....

btw, here's how I did it for access:

$ACCESSPATH = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msaccess.exe", "")
run('"' & $accesspath & '" "' & $myDB & '"')

<{POST_SNAPBACK}>

Thanks for that tip :)

I didnt even think about that.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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