# Get Started

## Install PowerShell Universal

You'll need to install the PowerShell Universal server. [There are a lot of ways to do so](https://docs.powershelluniversal.com/v4-beta/getting-started) but you can use the command line below to get started quickly.

{% tabs %}
{% tab title="Windows" %}
You can install PowerShell Universal as a service. Ensure that PowerShell is running as administrator or the service won't install correctly.&#x20;

```powershell
Install-Module Universal
Install-PSUServer
```

{% endtab %}

{% tab title="Windows Desktop" %}
You can learn more about [desktop mode here](https://docs.powershelluniversal.com/desktop/about-desktop-mode).
{% endtab %}

{% tab title="Linux" %}
You can install PowerShell Universal using the following shell script.

```
Install-Module Universal
Install-PSUServer
```

{% endtab %}

{% tab title="Mac OS X" %}
You can install PowerShell Universal using the Universal PowerShell module.

```
Install-Module Universal
Install-PSUServer -AddToPath
Start-PSUServer -Port 5000
```

{% endtab %}

{% tab title="Raspberry PI OS" %}

```
wget https://imsreleases.blob.core.windows.net/universal/production/2.4.0/Universal.linux-arm.2.4.0.zip
unzip Universal.linux-arm.2.3.2.zip -d ./PSU
chmod +x ./PSU/Universal.Server
./PSU/Universal.Server

```

{% endtab %}
{% endtabs %}

## Open PowerShell Universal

By default, PowerShell Universal is running on port 5000 of localhost. You can access the admin console with the username `admin` and `admin`.

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlAu6VJCrR2jbgLUonP%2F-MlB4sew_eGpZ1SGlGEU%2Fimage.png?alt=media\&token=0d64f1a4-024f-49c3-961d-0cd9ce34ad5e)

## Create an API

APIs allow you to call PowerShell scripts over HTTP. To create an API, click API \ Endpoints and click Create New Endpoint. Specify a URL.&#x20;

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlAu6VJCrR2jbgLUonP%2F-MlB59K29CL5jXaTEBgz%2Fimage.png?alt=media\&token=050facc3-f576-4c0b-a4ba-5edd79c8b807)

Next, click details on the API that was created an enter the following command into the editor.&#x20;

```
Get-ComputerInfo
```

Save the script and then click the Execute button to test it out.&#x20;

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlAu6VJCrR2jbgLUonP%2F-MlB5jhAMbRNN_V_kXhE%2Fimage.png?alt=media\&token=1eb16b66-3b04-48d4-ac4d-c54124591ec9)

You can also execute the API via `Invoke-RestMethod`.&#x20;

```
PS C:\Users\adamr> Invoke-RestMethod http://localhost:5000/hello-world

WindowsBuildLabEx                                       : 22000.1.amd64fre.co_release.210604-1628
WindowsCurrentVersion                                   : 6.3
WindowsEditionId                                        : Professional
WindowsInstallationType                                 : Client
WindowsInstallDateFromRegistry                          : 8/6/2021 4:05:12 PM
WindowsProductId                                        : 00330-52452-93139-AAOEM
WindowsProductName                                      : Windows 10 Pro
WindowsRegisteredOrganization                           :
```

## Create a Script

To create a script, click Automation \ Scripts and then click Create New Script.&#x20;

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlAu6VJCrR2jbgLUonP%2F-MlB6I6PJyOmC_nLl4vO%2Fimage.png?alt=media\&token=47522bad-de94-41d3-8a76-a51f07b3e4fa)

Enter the following script into the editor and save.&#x20;

```powershell
Read-Host "What should I say?"

1..100 | ForEach-Object {
    Write-Progress -PercentComplete $_ -Activity "Processing..."
}

Get-Service
```

Once the script is saved, click Run.&#x20;

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlAu6VJCrR2jbgLUonP%2F-MlB7HzQafQdXHBPFy07%2Frunjob.gif?alt=media\&token=960d6e05-0682-45b3-a23f-a051113cb51e)

## Create an App

To create a new PowerShell-based user interface (app), you can click User Interfaces \ Apps and then Create New App.&#x20;

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlB7O7EjSbEActDIv3w%2F-MlB7mz09PIT4YM0TsHB%2Fimage.png?alt=media\&token=2296154a-8eee-4493-bca4-c7566b43056f)

After clicking Ok, click the Details button to edit the PowerShell script. Add the following script to the editor.

```powershell
New-UDApp -Title "Hello, World!" -Content {
    New-UDButton -Text "Click Me" -OnClick {
        Show-UDToast -Message 'Success!!'
    }
}
```

Save the app, click the Restart button and then click the View button. Click the Click Me button.&#x20;

![](https://427210397-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6jY7sXTmhiAIMGYw_m%2F-MlB7O7EjSbEActDIv3w%2F-MlB8MLgwE1oBFmrXvhk%2Fimage.png?alt=media\&token=a9696ea2-d7cc-4418-ab0c-e1a455a60663)

Learn more about the various features of PowerShell Universal

* [APIs](https://docs.powershelluniversal.com/v4-beta/api/about)
* [Automation](https://docs.powershelluniversal.com/v4-beta/automation/about)
* [Apps](https://docs.powershelluniversal.com/v4-beta/userinterfaces/building-dashboards)


---

# 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://docs.powershelluniversal.com/v4-beta/get-started.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.
