Jump to content

RunAs inside the script


KatoXY
 Share

Recommended Posts

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.

Link to comment
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?

Link to comment
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.

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...