> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.appaloosa.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# PowerShell Scripts for Windows Devices

Appaloosa lets you run PowerShell scripts on your Windows managed devices from the dashboard, and view the result of each execution.

# Requirements

* The device must be enrolled as a Windows managed device, see [How to enroll your Windows devices](https://support.appaloosa.io/en/articles/13559908-how-to-enroll-your-windows-devices).
* Some Appaloosa components must be installed on the device. If they are missing, the **Add a script** button is disabled; contact us to learn more.
* Scripts are available to Administrator and Support users.

# Adding a script

* Open the device's page from your Inventory and go to the **Scripts** tab.
* Click **Add a script**.
* Enter a **Name**.
* Upload a **.ps1** file (1 MB maximum), or paste the script into the **Content** field.
* Click **Add**.

Scripts must be written in PowerShell. Wildcards are supported and replaced with the device and user values when the script is added, see [List of Wildcards available on Appaloosa](https://support.appaloosa.io/en/articles/9992769-list-of-wildcards-available-on-appaloosa).

# Execution

When the device is connected, it regularly checks whether scripts are waiting and runs them. Each script runs once on the device.

The **Scripts** tab lists every script added to the device, with:

* **Name**
* **Created by**: the user who added the script
* **Status**: **Pending** while the script is waiting for the device, **Sent** once the device has picked it up
* **Executed**: whether the device has reported the result

# Viewing the result

Click **Details** on a script to display:

* **Script**: the content that was sent to the device
* **Result**: the output of the script
* **Exit code**: the code returned by the script

As long as the device has not reported the result, **Not executed yet** is displayed.

# Deleting a script

Select one or more scripts in the list and delete them. Only **Pending** scripts can be deleted: a script that has already been sent to the device cannot be deleted.