> 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

## SINOSSI

Richiama uno script all'interno di PSU.

## SINTASSI

### Script

```
Invoke-PSUScript [-Script] <Script> [-WaitForDebugger] [-Environment <String>] [-Notes <String>]
 [-Credential <Variable>] [-Wait] [-Queue <String>] [-WaitTimeout <Int32>] [-Parameters <Hashtable>]
 [-Tags <Tag[]>] [-Silent] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

### Id

```
Invoke-PSUScript [-Id] <Int64> [-WaitForDebugger] [-Environment <String>] [-Notes <String>]
 [-Credential <Variable>] [-Wait] [-Queue <String>] [-WaitTimeout <Int32>] [-Parameters <Hashtable>]
 [-Tags <Tag[]>] [-Silent] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

### Name

```
Invoke-PSUScript [-WaitForDebugger] [-Environment <String>] [-Notes <String>] [-Credential <Variable>]
 [-Name] <String> [-Wait] [-Queue <String>] [-WaitTimeout <Int32>] [-Parameters <Hashtable>] [-Tags <Tag[]>]
 [-Silent] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

## DESCRIZIONE

Richiama uno script all'interno di PSU. Richiamare uno script avvia un nuovo processo di cui è poi possibile monitorare l'avanzamento.

## ESEMPI

### Esempio 1

```
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> Invoke-PSUScript -Script $Script
```

Richiama 'Script1.ps1'

### Esempio 2

```
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> Invoke-PSUScript -Script $Script -Parameter1 123 -Parameter2 "Test"
```

Richiama 'Script1.ps1' con i parametri Parameter1 e Parameter2. Questi parametri verranno passati allo script. Invoke-PSUScript supporta un numero qualsiasi di parametri dinamici.

### Esempio 3

```
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> $Password = Get-UAVariable -Name 'UserPassword'
PS C:\> $Credential = New-UDCredential -UserName 'adam' -Password $Password
PS C:\> Invoke-PSUScript -Script $Script -Credential $Credential
```

Richiama 'Script1.ps1' come utente 'adam'. Le password vengono recuperate dai gestori di segreti e non possono essere passate come stringhe.

## PARAMETRI

### -AppToken

Un token dell'app per accedere all'API di PSU.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

L'indirizzo HTTP del server dell'API REST di PSU.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Uri

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Credential

Le credenziali dell'utente con cui eseguire lo script. Usi New-UACredential per creare queste credenziali.

```yaml
Type: Variable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Environment

L'ambiente da utilizzare quando si richiama questo script. È possibile visualizzare gli ambienti disponibili usando Get-PSUEnvironment.

```yaml
Type: String
Parameter Sets: (All)
Aliases: PowerShellVersion

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Id

L'ID dello script da richiamare.

```yaml
Type: Int64
Parameter Sets: Id
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -Integrated

Esegue il comando internamente anziché usare l'API di gestione. Funziona solo quando lo script viene eseguito dall'interno di PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name

Il nome dello script da richiamare.

```yaml
Type: String
Parameter Sets: Name
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Notes

Note da includere con l'esecuzione del processo.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Script

Lo script da richiamare. Usi Get-PSUScript per recuperare gli script esistenti.

```yaml
Type: Script
Parameter Sets: Script
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -UseDefaultCredentials

Usa le credenziali predefinite durante la connessione all'API di gestione

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Wait

Attende l'esecuzione dello script prima di restituire il controllo.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WaitForDebugger

Non utilizzato.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -Queue

Il computer, il gruppo di computer o la coda su cui eseguire questo script.

```yaml
Type: String
Parameter Sets: (All)
Aliases: ComputerGroup

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Parameters

Una tabella hash di parametri da passare allo script. Può essere usata al posto dei parametri dinamici di questo cmdlet.

```yaml
Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WaitTimeout

Il numero di secondi di attesa.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Silent

Impedisce l'interazione con l'host PowerShell corrente. Non scriverà sui flussi né richiamerà Read-Host.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Tags

Tag da applicare al processo.

```yaml
Type: Tag[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrustCertificate

Indica se il cmdlet deve ignorare i problemi relativi ai certificati.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Cookies

Riutilizza e mantiene i cookie di autenticazione per la sessione PowerShell corrente.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable e -ProgressAction. Per maggiori informazioni, veda [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUT

### UniversalAutomation.Script

### System.Int64

## OUTPUT

### System.Object

## NOTE

## LINK CORRELATI

[Get-PSUEnvironment](/powershell-universal/it/comandi-powershell/get-psuenvironment.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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/it/comandi-powershell/invoke-psuscript.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
