antmar904 Posted October 4, 2016 Posted October 4, 2016 Hi, I have a application that needs to be installed as a local admin. I would like my regular users that do not have local admin rights be able to run my autoit script using the "RunAs" that will launch the application installer as the local admin but nothing is working. If DriveSpaceFree(@HomeDrive & "\") < 25000 Then $Log = FileOpen(@ScriptDir & "\SolidworksUpgrade.log", 9) FileWriteLine($Log, @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC & " There is not enough storage space on your computer to perform the SolidWorks upgrade, exiting script.") FileClose($Log) MsgBox(16, "Error", "Your computer does not have enough free space to install this update, exiting update.") Exit EndIf RunAs("Admin", @ComputerName, "passowrd", 1, "C:\Temp\sw2016.exe") I've tried every syntax possible.
antmar904 Posted October 4, 2016 Author Posted October 4, 2016 The only commonality I can see is if the program I am trying to run requires local admin rights (mmc.exe) the script will not work. But if I run the same script and launch (notepad.exe or calc.exe) the script works.
AdamUL Posted October 4, 2016 Posted October 4, 2016 RunAs and RunAsWait does not request the Admin Token (full admin rights) when running a process. They only run the process as the requested user, even if they are an admin. Have a look at this thread for an example to get around this. This is one of multiple was to accomplish this. The differences with mmc.exe, notpad.exe, and calc.exe is that mmc.exe has in its manifest to request the admin token. Calc.exe and notepad.exe does not have this execution level request. That is why the script works for calc.exe and notpad.exe, but not mmc.exe. Adam
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