Sign in to follow this  
Followers 0
KatoXY

RunAs inside the script

4 posts in this topic

Hi,

I'm writing a script which change determined values in registry (HKLM) in Windows 7 x64.

I want give compiled script for user whose don't have Admin rights.

How does it do to the normal user has launched a compiled program, Where is stored the local administrator password?

I can use RunAs command but I have to run external program. I would like keep all in one file.

Share this post


Link to post
Share on other sites



I think that what you are trying to do is not authorized by the forum rules. "Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc."

Maybe you could be a bit more specific as why you are trying to do that?

Share this post


Link to post
Share on other sites

One user in my company uses application which connecting to SQL database located on SQL Server.

He has also installed local SQL express. Sometimes he has to connect to local SQL.

Application doesnt have function to change DB and only way is change registry or reinstall it.

For this reason I wanted write a script which can do it.

My script looks following:

#RequireAdmin

Read()

RegWrite("HKLM64\SOFTWARE\AppS\SQLDef", "ServerName", "REG_SZ", "SQLServer01")
RegWrite("HKLM64\SOFTWARE\AppS\SQLDef", "InstanceName", "REG_SZ", "SQLServer01")
RegWrite("HKLM64\SOFTWARE\AppS\SQLDef", "DBName", "REG_SZ", "AppDB")
RegWrite("HKLM64\SOFTWARE\AppS\Common", "Path", "REG_SZ", "\\FS01\Common")

Read()

Func Read()
Local $val1 = RegRead("HKLM64\SOFTWARE\Apps\SQLDef", "DBVersion")
$val2 = RegRead("HKLM64\SOFTWARE\AppS\SQLDef", "ServerName")
$val3 = RegRead("HKLM64\SOFTWARE\AppS\SQLDef", "InstanceName")
$val4 = RegRead("HKLM64\SOFTWARE\AppS\SQLDef", "DBName")
$val5 = RegRead("HKLM64\SOFTWARE\AppS\Common", "Path")
MsgBox(4096, "Current Value", $val1 & @lf & $val2 & @lf & $val3 & @lf & $val4 & @lf & $val5)
EndFunc

I need run this script as admin and I want hide admin password inside the script. That's all.

I don't understand why you tell that I want to do something unauthorized.

Share this post


Link to post
Share on other sites

I can use RunAs command but I have to run external program. I would like keep all in one file.

Just do a RunAs of your own script with a Parameter so the seconds shelled version knows it needs to perform the task under elevated rights.

Jos


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

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