revertex Posted July 30, 2015 Share Posted July 30, 2015 @AdamULI have no words to thank you, I'm struggling for a long time for a solution to this problem.The closest I got is use runasspc, but it flashes a terminal every time it run, and popup a window with license info at random intervals.Your solution works like a charm.Some programs like coretemp don't run under restricted account, with your script I can launch It at login like it should. Link to comment Share on other sites More sharing options...
AdamUL Posted August 2, 2015 Share Posted August 2, 2015 @revertex Your welcome. I'm glad I was able to help you. Adam Link to comment Share on other sites More sharing options...
antmar904 Posted October 4, 2016 Share Posted October 4, 2016 Hi, I tried using this script for the same exact reason as jsnyder213 however it's not working for me. I get "ERROR!", "Unable to run under administrator account." expandcollapse popupGlobal $sAdminUser = "admin" Global $sAdminPassword = "password" Global $sDomain = @ComputerName Global $iLogOnFlag = 0 Global $sParameters = "" ;Elevate with the Admin account. If @UserName <> $sAdminUser And Not IsAdmin() Then $sParameters = "" If Not @Compiled Then $sParameters = ' "' & @ScriptFullPath & '"' EndIf If RunAs($sAdminUser, $sDomain, $sAdminPassword, $iLogOnFlag, @AutoItExe & $sParameters) Then Exit Else Exit MsgBox(16 + 262144, "ERROR!", "Unable to run under administrator account.") EndIf EndIf ;Run with Admin Token in Windows Vista and Higher. If @UserName = $sAdminUser And Not IsAdmin() And Not StringRegExp(@OSVersion, "_(XP|200(0|3))") Then $sParameters = "" If Not @Compiled Then $sParameters = '"' & @ScriptFullPath & '"' EndIf If ShellExecute(@AutoItExe, $sParameters, "", "runas") Then Exit Else Exit MsgBox(16 + 262144, "ERROR!", "Unable to elevate to Admin due to UAC.") EndIf EndIf ;Put rest of the script here. Run(@ScriptDir & "\sw2016.exe") Link to comment Share on other sites More sharing options...
AdamUL Posted October 4, 2016 Share Posted October 4, 2016 Is the admin account you are using a local account or a domain account? Confirm that the user is in the local Administrators group. This error usually means there is an issue with the account. Adam Link to comment Share on other sites More sharing options...
antmar904 Posted October 5, 2016 Share Posted October 5, 2016 It was an issue with the local admin account and the script works as intended! Thanks again, this is a life saver!. Link to comment Share on other sites More sharing options...
AdamUL Posted October 5, 2016 Share Posted October 5, 2016 Your welcome. Glad I could help. Adam 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