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

# New-DSGatewaySecurity

New-DSGatewaySecurity creates a GatewaySecurity object used to configure security settings when creating or updating a Devolutions Server gateway.

### Synopsis

Create a new GatewaySecurity object

### Syntax

#### \_\_AllParameterSets

```
New-DSGatewaySecurity [-GatewayPermissionOverride <SecurityRoleOverride>]
 [-CustomGatewayPermissions <guid[]>] [-VaultRoleOverride <GatewayVaultRoleOverride>]
 [-CustomVaultAccess <guid[]>] [-RDPTokenReuseWindow <int>] [-DisallowDynamicConnections]
 [-DisallowPrivateVaults] [-DisallowRDPReconnection] [-DisableRdpProxyCredentialInjection]
 [<CommonParameters>]
```

### Description

Create a new GatewaySecurity object that can be used to configure security settings when creating or updating gateways. These settings can also be configured on gateway rulesets and gateway farms.

### Examples

#### Example 1

```powershell
PS C:\> $security = New-DSGatewaySecurity -VaultRoleOverride All -DisallowDynamicConnections
PS C:\> Update-DSGateway -GatewayID $gatewayId -Security $security
```

Create a security configuration that gives permissions to all vaults and disables dynamic connections, then apply it to a gateway.

#### Example 2

```powershell
PS C:\> $vaultIds = @($vaultId1, $vaultId2)
PS C:\> $security = New-DSGatewaySecurity -VaultRoleOverride Custom -CustomVaultAccess $vaultIds -DisallowPrivateVaults
PS C:\> Update-DSGatewayRuleset -GatewayID $gatewayRulesetId -Security $security
```

Create a security configuration with access limited to specific vaults, disallow private vaults, and apply it to a gateway ruleset.

#### Example 3

```powershell
PS C:\> $principalIds = @($principalId1, $principalId2)
PS C:\> $security = New-DSGatewaySecurity -GatewayPermissionOverride Custom -CustomGatewayPermissions $principalIds -RDPTokenReuseWindow 5
PS C:\> New-DSGateway -Name 'MyGateway' -DevolutionsGatewayUrl 'https://gateway.example.com' -TCPListeningPort 8181 -Security $security
```

Create a gateway with custom permissions for specific users, user groups, or application identities and a 5-minute RDP token reuse window.

### Parameters

#### -CustomGatewayPermissions

List of principal IDs (users, user groups, or application identities) when GatewayPermissionOverride is set to Custom. Use Guid format or Guid string format.

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

#### -CustomVaultAccess

List of vault IDs when VaultRoleOverride is set to Custom. Use Guid format or Guid string format.

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

#### -DisableRdpProxyCredentialInjection

Disable RDP proxy credential injection.

```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: ''
```

#### -DisallowDynamicConnections

Disallow dynamic connections through the gateway.

```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: ''
```

#### -DisallowPrivateVaults

Disallow access to private vaults.

```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: ''
```

#### -DisallowRDPReconnection

Disallow RDP reconnection through the gateway.

```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: ''
```

#### -GatewayPermissionOverride

Gateway permission override mode (Default, Custom, Everyone, Never). The Default value is defined in the system settings. If Custom, specify principal IDs with CustomGatewayPermissions.

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

#### -RDPTokenReuseWindow

RDP token reuse window in minutes. Must be a positive integer.

```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: ''
```

#### -VaultRoleOverride

Which vaults the gateway grants access to (All, Custom, Never). If Custom, specify vault IDs with CustomVaultAccess.

```yaml
Type: Devolutions.Server.Models.Shared.Models.Gateway.GatewayVaultRoleOverride
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Outputs

#### Devolutions.Server.Models.Shared.Models.Gateway.GatewaySecurity

### Notes

For more information, type "Get-Help New-DSGatewaySecurity -detailed". For technical information, type "Get-Help New-DSGatewaySecurity -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 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/powershell-commands/new-dsgatewaysecurity.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.
