> 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/it/comandi-powershell/invoke-psuscript.md).

# Invoke-PSUScript

Invoke-PSUScript avvia un nuovo job per eseguire uno script all'interno di PowerShell Universal, restituendo un job di cui è possibile monitorare l'avanzamento e l'output.

## SINOSSI

Avvia un nuovo job di PowerShell Universal per uno script.

## SINTASSI

```powershell
Invoke-PSUScript -Script <Script> [-Environment <String>] [-Credential <Variable>] [-Notes <String>] [-WaitForDebugger] [-Wait] [-WaitTimeout <Int32>] [-Queue <String>] [-Parameters <Hashtable>] [-Tags <Tag[]>] [-Silent] [<ConnectionOptions>] [<CommonParameters>]
Invoke-PSUScript -Id <Int64> [-Environment <String>] [-Credential <Variable>] [-Notes <String>] [-WaitForDebugger] [-Wait] [-WaitTimeout <Int32>] [-Queue <String>] [-Parameters <Hashtable>] [-Tags <Tag[]>] [-Silent] [<ConnectionOptions>] [<CommonParameters>]
Invoke-PSUScript -Name <String> [-Environment <String>] [-Credential <Variable>] [-Notes <String>] [-WaitForDebugger] [-Wait] [-WaitTimeout <Int32>] [-Queue <String>] [-Parameters <Hashtable>] [-Tags <Tag[]>] [-Silent] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`. I parametri di script vengono esposti in modo dinamico anche quando è possibile.

## DESCRIZIONE

Avvia un job di cui è possibile seguire l'avanzamento con i cmdlet dei job. Selezioni uno script per nome, ID o oggetto script (che accetta l'input della pipeline). I parametri di script normali vengono esposti in modo dinamico. I parametri di script nascosti non vengono esposti deliberatamente come parametri dinamici del cmdlet, ma si possono fornire tramite la hashtable `-Parameters` e vengono passati allo script. Qui `-Credential` è una *variabile* di credenziale PSU per il job, non un `PSCredential` per l'autenticazione all'API di gestione.

## ESEMPIO

```powershell
Invoke-PSUScript -Name 'Deploy.ps1' -Parameters @{ Region = 'westus'; InternalToken = $token }
```

## PARAMETRI

| Parametro                | Descrizione                                                                              |
| ------------------------ | ---------------------------------------------------------------------------------------- |
| `-Script`                | Oggetto script da eseguire; accetta l'input della pipeline.                              |
| `-Id`                    | ID numerico dello script da eseguire; accetta l'input della pipeline.                    |
| `-Name`                  | Nome o percorso dello script da eseguire.                                                |
| `-Environment`           | Sostituzione dell'ambiente di esecuzione (alias `-PowerShellVersion`).                   |
| `-Credential`            | Variabile di credenziale PSU usata per il job.                                           |
| `-Notes`                 | Note archiviate con il job.                                                              |
| `-WaitForDebugger`       | Attende un debugger prima che il job venga eseguito.                                     |
| `-Wait`                  | Attende il completamento del job.                                                        |
| `-WaitTimeout`           | Timeout di attesa, in secondi.                                                           |
| `-Queue`                 | Coda di job o gruppo di computer (alias `-ComputerGroup`).                               |
| `-Parameters`            | Hashtable dei valori dei parametri dello script, inclusi i parametri di script nascosti. |
| `-Tags`                  | Tag da associare al job.                                                                 |
| `-Silent`                | Elimina l'output di esecuzione nella pipeline corrente.                                  |
| `-ComputerName`          | URL o nome host del server PSU di destinazione (alias `-Uri`).                           |
| `-AppToken`              | Token dell'app per l'API di gestione.                                                    |
| `-UseDefaultCredentials` | Usa le credenziali Windows correnti.                                                     |
| `-Integrated`            | Usa il client di gestione nel processo all'interno di PSU.                               |
| `-TrustCertificate`      | Ignora gli errori di convalida del certificato.                                          |
| `-Cookies`               | Riutilizza i cookie di autenticazione per questa sessione di PowerShell.                 |

## AUTORIZZAZIONI

Il token di accesso richiede `automation.scripts.<script path>/execute` per eseguire questo cmdlet in remoto. Il caricamento dei parametri dello script richiede anche `automation.scripts.<script path>/read`. La ricerca dello script può richiedere inoltre `automation.scripts/read` o `automation.scripts.<name>/read` quando si usa `-Name`. Senza `-Wait`, la lettura del nuovo job richiede `automation.jobs.<job ID>/read` o il ReadPermission configurato del job.


---

# 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/it/comandi-powershell/invoke-psuscript.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.
