Overview
impacket-atexec executes commands on a remote Windows host by creating a scheduled task via the ATSVC (Task Scheduler) named pipe. The command output is written to a temp file on the target and retrieved over SMB.
Useful when other execution methods (psexec, wmiexec, smbexec) are blocked but the Task Scheduler service is still accessible.
Authentication
Basic Usage
Execute a command and get output:How It Works
- Authenticates to the target over SMB (port 445)
- Connects to the ATSVC named pipe (Task Scheduler RPC interface)
- Creates a scheduled task set to execute immediately
- The task runs
cmd.exe /C <command> > %windir%\Temp\<random>.tmp 2>&1 - Reads the output file from the
ADMIN$share (ADMIN$\Temp\<random>.tmp, i.e.C:\Windows\Temp) over SMB - Deletes the output file and the scheduled task
OPSEC
Task name is random but follows a recognizable pattern. Detection rules commonly alert on rapid task create/delete cycles.
Pass-the-Hash
Kerberos Authentication
Requires a valid TGT in theKRB5CCNAME environment variable.
When to Use atexec
atexec is a single-command execution tool, not an interactive shell. For interactive access, use
wmiexec or smbexec.