Jump to content

A call the Experts


cpremo
 Share

Recommended Posts

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

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.

Link to comment
Share on other sites

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)
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

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...