# PsExec

This is a tool from the Sysinternals suite and allows users to execute code in remote hosts over port 445 using named pipes. This extracts from its executable image, an embedded Windows service named Psexesvc, copying it to the Admin$ share of the remote system and using the Windows Service Control Manager API to start the service on the remote system.

Ex.

```
psexec.exe -u DOMAIN\USER -p PASSWORD \\REMOTEIP ”COMMAND”
```

Or with Impacket:

```
python psexec.py DOMAIN/USER:PASSWORD@REMOTEIP [CMD]
```

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kwcsec.gitbook.io/the-red-team-handbook/techniques/lateral-movement/psexec.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
