herby Posted May 23 Share Posted May 23 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 Share Posted May 23 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 Link to comment Share on other sites More sharing options...
herby Posted May 23 Author Share Posted May 23 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 Share Posted May 23 32 minutes ago, ioa747 said: I just checked it, with Local Account it works fine. Link to comment Share on other sites More sharing options...
herby Posted May 23 Author Share Posted May 23 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 Share Posted May 23 ..add it to task scheduler ?, run it that way ? Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
herby Posted May 24 Author Share Posted May 24 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 Share Posted May 24 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 see my signature's stuff.FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
herby Posted May 25 Author Share Posted May 25 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 Author Share Posted May 25 The problem was Windows UAC argumentum 1 Link to comment Share on other sites More sharing options...
Somerset Posted May 25 Share Posted May 25 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 Author Share Posted May 26 Windows 10 Link to comment Share on other sites More sharing options...
Nisteo Posted May 26 Share Posted May 26 #RequireAdmin Why not? 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