Fix atexec task execution on 2025 servers#1251
Conversation
|
Hi and thanks! Could it be that the Win2025 server is just too slow and the error reporting is different on Win2025? The schtask created by atexec has the trigger "RegistrationTrigger" which should execute on creation. Either Win2025 is too slow, maybe bugged or even the trigger doesn't exist anymore? |
|
WinServ2025 is fucking trash bruuuh, remember the smb timeout -_- slow as fuck |
|
Tried a 60s timeout first didn’t help, the task still never ran. Imo the issue is the |
|
What happens if you configure one through the UI? Does this not work either? Is this trigger simply broken on Win 2025? |
|
UI / local PowerShell : same XML with Remote TSCH (NXC) : with only With So it’s not a broken trigger on 2025, it’s the remote registration path not starting the task reliably, we need an explicit |
|
Such a weird behavior. I would bet this is a bug in Win Server 2025, but just for getting it to work, let's add it. |
Description
Fixes
TSCH_EXEC / schtask_ason recent Windows (e.g. Server 2025) by callinghSchRpcRunafter task registration (as impacket’s atexec does) and treatingSCHED_S_TASK_HAS_NOT_RUN (0x41303)as a transient state duringSchRpcGetLastRunInfopolling instead of failing and deleting the task early.Type of change
Insert an "x" inside the brackets for relevant items (do not delete options)
Setup guide for the review
run
nxc smb 192.168.56.100 -u 'user' -p 'password' -M schtask_as -o USER='user'' CMD='whoami'Screenshots (if appropriate):
Before :
After :
Checklist:
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
poetry run ruff check ., use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)