Jump to content
Sign in to follow this  
cpremo

A call the Experts

Recommended Posts

cpremo

Is there no way to run a script feeding PC Administrator privileges???? i've tried and tried to get an install to run with Admin privileges eventhough the logged in user only has user rights. The script calls an INI file to obtain the file name with the Administrator name and password inside the script. It then opens the file (a BAT file that calls the installation application). It starts just fine then bombs out with this error code: "Error 1730. You must be an Administrator to remove this application. To remove this application, you can log on as an administrator, or contact your technical support group for assistance." Is there no way to accomplish this??????

Local $sUserName = "administrator"
    Local $sPassword = "password"
    Dim $Filename = IniRead ( @ScriptDir & "\SciTE.ini", "LogoData", "Destination1", "default" )
    $Domain = @ComputerName
    
If Not IsAdmin() Then
; Run a command prompt as the other user.
    local $pid = RunAs($sUserName, $Domain, $sPassword, 0, Run(@ComSpec & " /c " & $Filename), @ScriptDir)
    ProcessWaitClose($pid)
; Wait for the process to close.
   ;ProcessWaitClose($pid)
Else
    Run($Filename, @ScriptDir, @SW_HIDE)
EndIf

Share this post


Link to post
Share on other sites
KaFu
cpremo

Maybe try

local $pid = RunAs($sUserName, $Domain, $sPassword, 0, @ComSpec & " /c " & $Filename, @ScriptDir)

Doesn't seem to make any difference. Can't seem to get the process to work in an "Administrator" environment. I hits a wall trying to update files in the C:\Windows\System32 directory and crashes because the update is using the signed in "User" account who doesn't have Admin privileges to the PC.

Share this post


Link to post
Share on other sites
HypercamJ

Are you running Vista or XP?


Prove, and I will believe...

Share this post


Link to post
Share on other sites
KaFu

Is a command prompt really needed (doesn't seem so from your 'else' clause) ? Maybe the way I mentioned above the cmd.exe runs with Admin privs, but the invoked prog doesn't? Try something like

local $pid = RunAs($sUserName, $Domain, $sPassword, 0, $Filename, @ScriptDir)

Share this post


Link to post
Share on other sites
cpremo

Is a command prompt really needed (doesn't seem so from your 'else' clause) ? Maybe the way I mentioned above the cmd.exe runs with Admin privs, but the invoked prog doesn't? Try something like

local $pid = RunAs($sUserName, $Domain, $sPassword, 0, $Filename, @ScriptDir)

That was my original code before I posted this Call to the Experts. I change to the posted code but it didn't work either.

Share this post


Link to post
Share on other sites
KaFu

That was my original code before I posted this Call to the Experts. I change to the posted code but it didn't work either.

If i compare that line to the original code in your first post it is different...

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.