AutoHotkey Community

It is currently May 26th, 2012, 8:29 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: March 10th, 2009, 5:33 am 
Offline

Joined: November 25th, 2004, 10:08 am
Posts: 57
I've got an Autohotkey script setup to run at login on a Windows Vista machine (now actually running Windows 7 beta). Initially I just put it in the startup folder but found that various hotkeys won't work when the active window has elevated permission (eg. devicemanager, task scheduler, other control panel windows that require UAC elevation).

So I used the trick of launching the script from the task scheduler, set to launch at login using the elevated permission option.

This does allow the script to run regardless of the permission level of the active window, presumably because the script itself is now running with elevated permission.

However, the script also has several hotkeys that launch other applications using the run command (either applications, or opening folders with "explorer path").

Does this mean that when launched from the hotkey, those applications will inherit the scripts elevated permissions or will they launch with normal user permissions? If the former, is there any way to specify for the run command to use a lower permissions setting? Or should I be splitting this up into 2 scripts, one just for those that require elevated permissions to work within all windows, and putting everything else in a second script run from the startup folder?

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 5:43 am 
disable UAC
google for how to do it

alternatively, you can decide the permission level while compiling scripts
for that use this compiler


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 11:57 am 
Offline

Joined: November 25th, 2004, 10:08 am
Posts: 57
Anonymous wrote:
disable UAC
google for how to do it

alternatively, you can decide the permission level while compiling scripts
for that use this compiler


I have no interest in disabling UAC as I feel it's a useful security feature and I can load scripts without prompts using the task scheduler. I'm just trying to understand how permission inheritance works when launching apps from within a script.

thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 9:18 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
while UAC is nice you can set certain programs to run with elevated rights
http://www.autohotkey.com/forum/viewtop ... highlight=

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2009, 6:43 pm 
Offline

Joined: August 18th, 2009, 11:11 pm
Posts: 7
How did you manage to start your scripts properly by scheduler? Whenever i start it (in scheduler) it just sits in the taskmanager and doesn't work. There's also no systray icon. What's the trick? Can you give some details? That would really help a lot.

I'm using the gui version of the win7 scheduler. My script is just a simple one:
Code:
MButton::WinClose A

It closes the active window with 3rd mouse button but it doesn't work on high privileged windows so i want to try the scheduler method as well.

Image

Edit: I have to check 'only start if user is logged on'. Now it starts properly but there are still immune windows i can't close. Currently i'm testing it with 'firewall control'. Any ideas?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2009, 10:21 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
I suspect it does inherit the permissions from the script that started it. Easy way to test: have it call a script that writes a file in the windows or program files folders. Then run that same script as a normal user.

The runAs option (or command, i can't check which) should let you run another script with lower permissions. For security, you might want to make a user specially for this.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2009, 10:45 pm 
Offline

Joined: August 18th, 2009, 11:11 pm
Posts: 7
engunneer wrote:
I suspect it does inherit the permissions from the script that started it.

I can't follow... there is now previous script invoking this one.

AHK is started in admin user context and this extra flag (in scheduler) 'start with highest privileges'. Trying to start it as LOCAL SERVICE or SYSTEM doesn't work. Not sure if this would be the solution. Its not possible this way.

Edit: Never mind...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2009, 11:49 pm 
What is nice about UAC?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2009, 7:37 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
I was refering to
Quote:
However, the script also has several hotkeys that launch other applications using the run command (either applications, or opening folders with "explorer path").


I suspect that the applications started by your script inherit the script's permissions.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Pulover, tomoe_uehara and 52 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group