> 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/new-psuloggingtarget.md).

# New-PSULoggingTarget

New-PSULoggingTarget crea una destinazione di registrazione in PowerShell Universal che instrada gli eventi di log verso una destinazione personalizzata in base al livello, all'ambito e alla funzional

## SYNOPSIS

Crea una nuova destinazione di registrazione in PowerShell Universal.

## SYNTAX

```
New-PSULoggingTarget -Type <String> [-Properties <Hashtable>] [-Level <String>] [-Feature <String>]
 [-Resource <String>] [-Scope <String>] [-ScriptBlock <ScriptBlock>] [-ComputerName <String>]
 [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate]
 [-Cookies] [<CommonParameters>]
```

## DESCRIPTION

Crea una nuova destinazione di registrazione in PowerShell Universal.

## EXAMPLES

### Esempio 1

```powershell
New-PSULoggingTarget -Type 'PowerShell' -Level 'Information' -Scope User -Feature API -ScriptBlock {
    param($LogEvent, $Message) 
    
    $Message | Out-File C:\logs\log.txt
}
```

Una destinazione di registrazione personalizzata che scrive su un file.

## PARAMETERS

### -AppToken

L'AppToken utilizzato per chiamare la Management API di PowerShell Universal. È inoltre possibile chiamare Connect-PSUServer prima di questo cmdlet per impostare l'AppToken per l'intera sessione.

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

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

### -ComputerName

Specifica il nome del computer o l'URL da chiamare quando si accede alla Management API di PowerShell Universal. È inoltre possibile utilizzare Connect-PSUServer prima di questo cmdlet per impostare il nome del computer per l'intera sessione.

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

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

### -Feature

La funzionalità da cui questa destinazione di registrazione riceverà i messaggi.

```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: Configuration, App, Automation, API

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

### -Integrated

Esegue il comando internamente anziché utilizzare la Management API. Funziona solo quando lo script viene eseguito all'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
```

### -Level

Il livello di log di base da cui questa destinazione di registrazione riceverà i messaggi.

```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: Verbose, Debug, Information, Warning, Error, Fatal

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

### -Properties

Le proprietà che devono essere passate alla destinazione di registrazione.

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

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

### -Resource

La risorsa da cui questa destinazione di registrazione riceverà i messaggi.

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

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

### -Scope

L'ambito da cui questa destinazione di registrazione riceverà i messaggi.

```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: User, System

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

### -ScriptBlock

Il blocco di script che verrà eseguito alla ricezione di un messaggio di log quando si utilizza la destinazione di registrazione PowerShell.

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

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

### -Type

Il tipo di destinazione di registrazione da creare.

```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: File, Database, PowerShell, TCP, UDP, HTTP

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

### -UseDefaultCredentials

Utilizza le credenziali dell'utente corrente.

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

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

### -Credential

Credenziali per l'accesso alla Management API di PowerShell Universal.

```yaml
Type: PSCredential
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).

## INPUTS

### Nessuno

## OUTPUTS

### PowerShellUniversal.LoggingTarget

## NOTES

## RELATED LINKS


---

# 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/new-psuloggingtarget.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.
