cpremo Posted February 2, 2009 Share Posted February 2, 2009 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 More sharing options...
KaFu Posted February 2, 2009 Share Posted February 2, 2009 Maybe try local $pid = RunAs($sUserName, $Domain, $sPassword, 0, @ComSpec & " /c " & $Filename, @ScriptDir) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
cpremo Posted February 4, 2009 Author Share Posted February 4, 2009 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 More sharing options...
HypercamJ Posted February 5, 2009 Share Posted February 5, 2009 Are you running Vista or XP? Prove, and I will believe... Link to comment Share on other sites More sharing options...
KaFu Posted February 5, 2009 Share Posted February 5, 2009 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) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
cpremo Posted February 9, 2009 Author Share Posted February 9, 2009 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 More sharing options...
KaFu Posted February 9, 2009 Share Posted February 9, 2009 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... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now