1

We have been using the Task Scheduler and PsExec to run an app with many elevated privilages on bootup of windows 11 machines. We have seen issues with recent updates (not on all machines surprisingly) where the app will no longer start on bootup. Psexec fails to start.

We can alleviate the issue by running a try powershell try loop for PsExec, and after about 60 seconds to 2 minutes, PsExec will finally start correctly. Something at boot is now stopping PsExec from operating correctly. We really need our app to start asap, and even 60 seconds is too long.

We have verified the permissions within the task scheduler task are correct, as the app does eventually start if in a loop, or we start the app manually. We also need to have '-i' and '-s' flags for psexec, as we need input access (SendInput()), and access to session 0 (for UAC prompts). We have updated windows 11 to the most recent update, and also updated PsExec to the latest version (v2.43). We would just run our app in Services, but we need session 1 access (which can access session 0, but not the other way around from my understanding).

PsExec error:

PsExec v2.4 - Execute processes remotely
Copyright (C) 2001-2022 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec64.exe : Connecting to local system...
At C:\Program Files\TestDir\scripts\run.ps1:5 char:1
+ & C:\Program` Files\TestDir\bin\PsExec64.exe -i -s -w "C:\Program Fi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Connecting to local system...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 


Starting PSEXESVC service on local system...


Copying authentication key to TEMPLATE-WINDOW...


Error creating key file on TEMPLATE-WINDOW:
The handle is invalid.

PsExec expected behavior:

PsExec v2.4 - Execute processes remotely
Copyright (C) 2001-2022 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec64.exe : Connecting to local system...
At C:\Program Files\TestDir\scripts\run.ps1:5 char:1
+ & C:\Program` Files\TestDir\bin\PsExec64.exe -i -s -h -w "C:\Program ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Connecting to local system...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 


Starting PSEXESVC service on local system...


Copying authentication key to TEMPLATE-WINDOW...


Connecting with PsExec service on TEMPLATE-WINDOW...


Starting cmd on TEMPLATE-WINDOW...



cmd exited on TEMPLATE-WINDOW with error code 0.
vulkur
  • 11
  • 1
  • Do you know which command causes the error? If not, you could add debug trace to a local file. – harrymc Apr 14 '23 at 11:51
  • no commands that we are calling within PsExec are causing the error, its PsExec that is causing the error, whatever we call from it never starts. – vulkur Apr 14 '23 at 15:30
  • Can you try using an administrator account for psexec, instead of SYSTEM ? – harrymc Apr 14 '23 at 16:03

0 Answers0