herby Posted May 23, 2023 Share Posted May 23, 2023 Hello, since the Windows 22h2 update, my Autoit script using the RunAs() function as an administrator no longer works. It works fine on previous versions of Windows. Do you know if this update has changed a security rule that prevents Autoit from performing a RunAs() as an administrator? I haven't found any information about it. Link to comment Share on other sites More sharing options...
ioa747 Posted May 23, 2023 Share Posted May 23, 2023 Edition Windows 10 Pro, Version 22H2 I just checked it, with Local Account it works fine. You only need to enter the password and not the PIN #include <AutoItConstants.au3> Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "UserName" Local $sPassword = "password" ;* <- Password, not the Windows Hello PIN ; Run Notepad with the window maximized. Notepad is run under the user previously specified. Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, $RUN_LOGON_NOPROFILE, "notepad.exe", "", @SW_SHOWMAXIMIZED) ; Wait 10 seconds for the Notepad window to appear. WinWait("[CLASS:Notepad]", "", 10) ; Wait for 2 seconds. Sleep(2000) ; Close the Notepad process using the PID returned by RunAs. ProcessClose($iPID) EndFunc ;==>Example I know that I know nothing Link to comment Share on other sites More sharing options...
herby Posted May 23, 2023 Author Share Posted May 23, 2023 Thank you, but I forgot to mention that the AutoIt script is executed on computers within a domain, and the administrator account is local to the computers. With this configuration, it no longer works. Link to comment Share on other sites More sharing options...
ioa747 Posted May 23, 2023 Share Posted May 23, 2023 32 minutes ago, ioa747 said: I just checked it, with Local Account it works fine. I know that I know nothing Link to comment Share on other sites More sharing options...
herby Posted May 23, 2023 Author Share Posted May 23, 2023 I can't modify password because i'm on domain account. Link to comment Share on other sites More sharing options...
argumentum Posted May 23, 2023 Share Posted May 23, 2023 ..add it to task scheduler ?, run it that way ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
herby Posted May 24, 2023 Author Share Posted May 24, 2023 Same result, cmd.exe open but not as administrator same for notepad++. I haven't had this problem on versions other than 22H2. Local $sTaskName = "MaTachePlanifieeTEST" Local $sTaskCommand = RunAs("administrateur",@ComputerName,"*****",0, "cmd.exe") ; Enregistre la tâche planifiée RunWait(@ComSpec & ' /c schtasks.exe /create /tn "' & $sTaskName & '" /tr "' & $sTaskCommand & '" /sc minute /mo 1', "", @SW_HIDE) If @error Then MsgBox($MB_ICONERROR, "Erreur", "Erreur lors de la création de la tâche planifiée.") Else MsgBox($MB_ICONINFORMATION, "Succès", "La tâche planifiée a été créée avec succès.") EndIf Link to comment Share on other sites More sharing options...
argumentum Posted May 24, 2023 Share Posted May 24, 2023 4 minutes ago, herby said: $sTaskCommand = RunAs("administrateu ...what I meant is to run with the credentials stored in TaskSched instead of the script. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
herby Posted May 25, 2023 Author Share Posted May 25, 2023 I did not find how to do it, do you have a documentation? Link to comment Share on other sites More sharing options...
herby Posted May 25, 2023 Author Share Posted May 25, 2023 The problem was Windows UAC argumentum 1 Link to comment Share on other sites More sharing options...
Somerset Posted May 25, 2023 Share Posted May 25, 2023 There is a windows 11 version with the same 22h2 moniker version and the OP never mentioned if it was 10 or 11? Link to comment Share on other sites More sharing options...
herby Posted May 26, 2023 Author Share Posted May 26, 2023 Windows 10 Link to comment Share on other sites More sharing options...
Nisteo Posted May 26, 2023 Share Posted May 26, 2023 #RequireAdmin Why not? Link to comment Share on other sites More sharing options...
Kanjookaran Posted December 8, 2023 Share Posted December 8, 2023 Hi All, This is Manoj. Anyone has a proper solution for this problem. I am in the situation when I run the script as RunAs with local admin creds the script is getting paused. I used #RequireAdmin , but it prompts for user to enter password. I am running in a windows domain environment , so I cant give the local admin password to use. I am running this AutoIT script using the GPO. Any help would be much appreciated to get this problem sorted. Regards Manoj Joseph 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