Jump to content
Sign in to follow this  
damon

Need to start a script as admin

Recommended Posts

damon

I have looked for this but can not find what I am trying to do.

I have a script and need it to promote its self to admin

I know that runas is the way but with the script I am running it recalls the file.

Local $user = "admin"
Local $pass = "password"


If IsAdmin () = 0 Then
    If RunAs ( $user, @ComputerName, $pass, 0,@autoitexe, @scriptdir) = 0 Then
        MsgBox (0, "Xport Update", "Xport Update Failed.  Please Contact Support Technican for Installation Update" & @CRLF & "ERROR 0001")
        Exit
    EndIf
EndIf

$w = 0
Do
If ProcessExists ("Xport.exe") <> 0 Then
    If ProcessClose ("Xport.exe") = 0 Then
        MsgBox (0, "Xport Update", "Xport Update Failed.  Please Contact Support Technican for Installation Update" & @CRLF & "ERROR 0005")
        Exit
    EndIf

EndIf
$w = $w + 1
Until $w = 5

If ProcessExists ("Xport.exe") <> 0 Then
    MsgBox (0, "Xport Update", "Xport Update Failed.  Please Contact Support Technican for Installation Update" & @CRLF & "ERROR 0007")
    Exit
EndIf

If FileCopy ("xport.exe", "C:\GPS Software\Xport\xport.exe",9) = 0 Then
    MsgBox (0, "Xport Update", "Xport Update Failed.  Please Contact Support Technican for Installation Update" & @CRLF & "ERROR 0010")
    Exit
EndIf
If FileCopy ("xport.exe.manifest", "C:\GPS Software\Xport\xport.exe.manifest",9) = 0 Then
    MsgBox (0, "Xport Update", "Xport Update Failed.  Please Contact Support Technican for Installation Update" & @CRLF & "ERROR 0015")
    Exit
EndIf

MsgBox (0, "Xport Update", "Xport Update Completed Successfully.  Please Reboot Computer")

Windows XP Service pack 3 machine


It always amazes me how one little thing can cause so much havoc

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  

×