> 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/it/powershell-commands/new-rdmport.md).

# New-RDMPort

### Sinossi

Genera uno o più numeri di porta in base ai parametri specificati.

### Sintassi

#### \_\_AllParameterSets

```
New-RDMPort [-Count <int>] [-ExcludePort <int[]>] [-IncludeWellKnownPorts] [-IncludeRegisteredPorts]
 [-IncludePortsUsedByOthersSessions] [-Maximum <int>] [-Minimum <int>]
 [-ForcePromptAnswer <DialogResult[]>] [<CommonParameters>]
```

### Descrizione

Genera uno o più numeri di porta in base ai parametri specificati.

### Esempi

#### Esempio 1

```powershell
PS C:\> $port = New-RDMPort -Minimum 50 -Maximum 2048 -IncludeWellKnownPorts -IncludeRegisteredPorts -IncludePortsUsedByOthersSessions
```

Genera una porta tra 50 e 2048. La porta può essere già utilizzata da un'altra sessione oppure essere una porta well known o registrata.

#### Esempio 2

```powershell
PS C:\> $port = New-RDMPort -Minimum 10 -Maximum 15 -IncludeWellKnownPorts -IncludeRegisteredPorts -ExcludePort 11,12,13
```

La porta avrà un valore pari a 10, 14 o 15. Se un'altra sessione utilizza una di queste porte, tale porta verrà esclusa dalle possibilità.

#### Esempio 3

```powershell
PS C:\> $ports = New-RDMPort -Count 10
```

Verranno generate 10 porte e memorizzate in $ports.

#### Esempio 4

```powershell
PS C:\> $sess = Get-RDMSession -Name ARemotePwsh; $sess.PowerShell.Port = New-RDMPort -Minimum 1024; Set-RDMSession -Session $sess -Refresh
```

L'utente recupera una sessione remote powershell esistente denominata ARemotePwsh e ne modifica la porta. La nuova porta è almeno 1024, non è una porta well known, non è una porta registrata e non è utilizzata da altre sessioni. L'utente salva la modifica.

### Parametri

#### -Count

Numero di porte da generare. Il valore predefinito è 1.

```yaml
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -ExcludePort

Queste porte non verranno generate.

```yaml
Type: System.Int32[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -ForcePromptAnswer

Opzione da usare con cautela. Risponde automaticamente ai prompt che pongono domande sì/no, sì/no/annulla oppure ok/annulla. In caso di prompt multipli, è possibile passare più valori a questo parametro. Ecco i valori accettati:

* Yes: accetta il prompt. Copre i valori OK e Automatic.
* No: rifiuta il prompt sì/no/annulla. "Cancel" è l'opzione di fallback se non è presente l'opzione "No".
* Cancel: annulla il prompt sì/no/annulla. "No" è l'opzione di fallback se non è presente l'opzione "Cancel".

```yaml
Type: System.Windows.Forms.DialogResult[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -IncludePortsUsedByOthersSessions

Consente la generazione di porte utilizzate da altre sessioni.

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -IncludeRegisteredPorts

Consente la generazione di porte registrate. Per un elenco delle porte registrate, vedere: <https://en.wikipedia.org/wiki/List\\_of\\_TCP\\_and\\_UDP\\_port\\_numbers#Registered\\_ports>

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -IncludeWellKnownPorts

Consente la generazione di porte well known. Per un elenco delle porte well known, vedere: <https://en.wikipedia.org/wiki/List\\_of\\_TCP\\_and\\_UDP\\_port\\_numbers#Well-known\\_ports>

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -Maximum

Valore massimo della porta generata. Per impostazione predefinita, il limite è fissato al massimo assoluto 65 535.

```yaml
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -Minimum

Valore minimo della porta generata. Per impostazione predefinita, il limite è fissato a 0. Un valore consigliato è 1024.

```yaml
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### CommonParameters

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

### Note

Per maggiori informazioni, digitare "Get-Help New-RDMPort -detailed". Per informazioni tecniche, digitare "Get-Help New-RDMPort -full".


---

# 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/it/powershell-commands/new-rdmport.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.
