> For the complete documentation index, see [llms.txt](https://kwcsec.gitbook.io/the-red-team-handbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kwcsec.gitbook.io/the-red-team-handbook/techniques/persistence/admin-level/services.md).

# Services

We can abuse services for persistence, for this example, we will create a new service called "UpdaterServ":&#x20;

```
sc create UpdaterServ binpath= "c:\binary" start= auto
```

We can see If it worked with:

```
sc query UpdaterServ
```

We can finally start the service with:

```
sc start UpdaterServ
```

Note: You will get an error if your persistence executable does not contain the necessary functions to function as a windows service. For more information on how to write a windows service:&#x20;

{% embed url="<https://www.codeproject.com/Articles/499465/Simple-Windows-Service-in-Cplusplus>" %}

You can also modify an existing service to point to your persistence executable like so:&#x20;

```
sc stop UpdaterServ
sc config UpdaterServ binpath= "c:\binary"
sc start UpdaterServ
```
