Jump to content

Problem with RunAs() and Windows 22h2


Recommended Posts

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

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


KXW17C9.png

 

#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

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

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

  • 6 months later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...