Use the built-in schtasks.exe command to create and manipulate Windows tasks (basically the equivalent of *NIX cron jobs).
Local tasks
Exploit local Windows tasks
If a task points to a file that you’ve obtained write access to, then that file can be altered without changing the underlying task.
It may also be possible to create your own tasks.
Stealthy tasks
Deleting the task Security Descriptor will make the task invisible to any user in the system. Note that this requires PsExec!
Link to original
Use
PsExec64.exe -s -i regedit
to open regedit with SYSTEM privileges.Search in
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\
for the task to hide. Under the key for that task, there will be a value named SD that contains the security descriptor. Simply delete it.
Remote tasks
Exploit remote Windows tasks
Warning
By default, UAC restricts remote schtasks.exe calls to domain admins and the default local “Administrator” account. Local Windows admins cannot call this service remotely without first disabling UAC!
The schtasks.exe command can also be used to create and manipulate services on remote machines. This uses the Windows RPC (TCP 135), but will fall back to named pipes over SMB (TCP 445) or NetBIOS (TCP 139). (In fact, this is how schtasks.exe works locally as well; the only difference is that in this case a local named pipe is always used.)
Link to original