AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

if not A_IsAdmin... restart script without manual entering?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
SecurityAnalysis
Guest





PostPosted: Fri Mar 14, 2008 7:47 pm    Post subject: if not A_IsAdmin... restart script without manual entering? Reply with quote

I use this code snippet on a Windows 2000 system. Is it possible to change the code a bit so that I don't have to enter the password manually? Or is there any other way for a script to give itself admin rights without manual input?

Code:

if not A_IsAdmin
{
   DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath
      , str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
   ExitApp
}
Back to top
SecurityAnalysis
Guest





PostPosted: Wed Mar 19, 2008 10:48 pm    Post subject: Reply with quote

Is it possible to change the code a bit so that I don't have to enter the password manually upon Runas restart?
Back to top
SecurityAnalysis
Guest





PostPosted: Fri May 16, 2008 6:54 pm    Post subject: Reply with quote

Bump
Back to top
Conquer



Joined: 27 Jun 2006
Posts: 385
Location: Canada

PostPosted: Fri May 16, 2008 10:18 pm    Post subject: Reply with quote

Sounds... Sly

Surprised



Um, use the command RunAs ?

lolz
Back to top
View user's profile Send private message
Troll
Guest





PostPosted: Fri May 16, 2008 11:18 pm    Post subject: Reply with quote

Sry you fail at internetz lol
Back to top
bkpsusmitaa



Joined: 09 Jan 2009
Posts: 6

PostPosted: Fri Jan 09, 2009 8:05 am    Post subject: whether A_IsAdmin can be tweaked a bit to automate process Reply with quote

The popular code A_IsAdmin:

Quote:
if not A_IsAdmin
{
DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath
, str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
ExitApp
}


is oft-quoted to be placed at the top of a script, but no reply has been found to contain a solution as to whether in WindowsXP an owner of the computer, who is an administrator, but chooses to carry on his day-to-day activity as a guest, can automate the script so that the window for username and password does not appear any longer, but the script is run.

In nutshell, can someone please elaborate wordwise / phrasewise analysis of the above quoted script?

For example,
(1) DllCall : we know
(2) shell32\ShellExecuteA : calls the shell32 file to execute some work
(3) uint : something we do not know
(4) 0 : why is 0 written
(5) str: the need for str
...
so on and so forth

Knowledgeable people please help spread knowledge and prevent knowledge becoming extinct.

Regards
_________________
I am Rajib Kumar Bandopadhyay, living in India, in service, love computing
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group