> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/apps/scheduled-endpoints.md).

# Scheduled Endpoints

Schedule lightweight PowerShell script blocks inside PowerShell Universal apps with New-UDEndpoint to cache data like process lists for faster dashboards.

{% hint style="info" %}
We recommend you consider [Scheduled jobs](/powershell-universal/automation/schedules.md) over scheduled endpoints for jobs that require tracking of output, input, history or complex scheduling rules.
{% endhint %}

Scheduled endpoints allow you to run PowerShell script blocks on a schedule within your App. Scheduled endpoints are more light weight than scheduled jobs but do not provide the same level of functionality. They do not track any history, the output is not logged and the schedules are not visible within the UI.

Scheduled endpoints are useful when loading and caching data that you will only use in your dashboard. Data stored within the app cache is not shared across PowerShell Universal.

## Scheduling an Endpoint

The below is an example of scheduling an endpoint that runs every 10 seconds and stores information in a cache variable. This type of configuration increases performance of the app for end users since the cache data is returned rather than calling `Get-Process` with each load of the app.

```powershell
$EndpointSchedule = New-UDEndpointSchedule -Every 10 -Second
New-UDEndpoint -Schedule $EndpointSchedule -Endpoint {
    $Cache:Processes = Get-Process | Select-Object Name,ID
} | Out-Null

New-UDApp -Title 'Test' -Content {
    New-UDTable -Data $Cache:Processes
}
```

### Caching Server-Wide Data

You can also use the[ server-wide data ](/powershell-universal/platform/cache.md)caching features in Apps. This means that you will be able to access that data throughout PowerShell Universal scripts. In your app, you can load the cache with the scheduled endpoint.

```powershell
$EndpointSchedule = New-UDEndpointSchedule -Every 10 -Second
New-UDEndpoint -Schedule $EndpointSchedule -Endpoint {
   $Processes = Get-Process | Select-Object Name,ID
   Set-PSUCache -Name 'Processes' -Value $Processes
} | Out-Null

New-UDApp -Title 'Test' -Content {

}
```

You can then use the cache data in your API.

```powershell
New-PSUEndpoint -Url '/process' -Method Get -Endpoint {
    Get-PSUCache -Name 'Processes'
}
```

## API

* [New-UDEndpoint](/powershell-universal/powershell-commands/new-udendpoint.md)
* [New-UDEndpointSchedule](/powershell-universal/powershell-commands/new-udendpointschedule.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/apps/scheduled-endpoints.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
