Add-VMNetworkAdapterExtendedAcl

Add-VMNetworkAdapterExtendedAcl

Creates an extended ACL for a virtual network adapter.

Sintaxis

Parameter Set: VMName
Add-VMNetworkAdapterExtendedAcl [-VMName] <String[]> [-Action] <VMNetworkAdapterExtendedAclAction> [-Direction] <VMNetworkAdapterExtendedAclDirection> [[-LocalIPAddress] <String> ] [[-RemoteIPAddress] <String> ] [[-LocalPort] <String> ] [[-RemotePort] <String> ] [[-Protocol] <String> ] [-Weight] <Int32> [-ComputerName <String[]> ] [-IdleSessionTimeout <Int32> ] [-IsolationID <Int32> ] [-Passthru] [-Stateful <Boolean> ] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ManagementOS
Add-VMNetworkAdapterExtendedAcl [-Action] <VMNetworkAdapterExtendedAclAction> [-Direction] <VMNetworkAdapterExtendedAclDirection> [[-LocalIPAddress] <String> ] [[-RemoteIPAddress] <String> ] [[-LocalPort] <String> ] [[-RemotePort] <String> ] [[-Protocol] <String> ] [-Weight] <Int32> -ManagementOS [-ComputerName <String[]> ] [-IdleSessionTimeout <Int32> ] [-IsolationID <Int32> ] [-Passthru] [-Stateful <Boolean> ] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ResourceObject
Add-VMNetworkAdapterExtendedAcl [-VMNetworkAdapter] <VMNetworkAdapterBase[]> [-Action] <VMNetworkAdapterExtendedAclAction> [-Direction] <VMNetworkAdapterExtendedAclDirection> [[-LocalIPAddress] <String> ] [[-RemoteIPAddress] <String> ] [[-LocalPort] <String> ] [[-RemotePort] <String> ] [[-Protocol] <String> ] [-Weight] <Int32> [-IdleSessionTimeout <Int32> ] [-IsolationID <Int32> ] [-Passthru] [-Stateful <Boolean> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Add-VMNetworkAdapterExtendedAcl [-VM] <VirtualMachine[]> [-Action] <VMNetworkAdapterExtendedAclAction> [-Direction] <VMNetworkAdapterExtendedAclDirection> [[-LocalIPAddress] <String> ] [[-RemoteIPAddress] <String> ] [[-LocalPort] <String> ] [[-RemotePort] <String> ] [[-Protocol] <String> ] [-Weight] <Int32> [-IdleSessionTimeout <Int32> ] [-IsolationID <Int32> ] [-Passthru] [-Stateful <Boolean> ] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Descripción detallada

The Add-VMNetworkAdapterExtendedAcl cmdlet creates an extended access control list (ACL) for a virtual network adapter. The ACL allows or denies access to a virtual machine network adapter for network packets based on source IP address, destination IP address, protocol, source port, and destination port.

Parámetros

-Action<VMNetworkAdapterExtendedAclAction>

Specifies the action for the ACL. Los valores aceptables para este parámetro son los siguientes:

-- Allow
-- Deny

Alias

ninguno

¿Requerido?

true

¿Posición?

2

Valor predeterminado

None

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-ComputerName<String[]>

Specifies an array of Hyper-V hosts. The cmdlet adds the ACL to the network adapters on the Hyper-V hosts that you specify.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Direction<VMNetworkAdapterExtendedAclDirection>

Specifies the direction of network traffic, from the perspective of the virtual machine, to which the ACL applies. The cmdlet adds an ACL that has the value that you specify. Los valores aceptables para este parámetro son los siguientes:

-- Inbound
-- Outbound

If you run the Get-VMNetworkAdapterExtendedAcl cmdlet, the entry that you create appears in both the inbound ACL and the outbound ACL.

Alias

ninguno

¿Requerido?

true

¿Posición?

3

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-IdleSessionTimeout<Int32>

Specifies a time-out period, in seconds, for idle sessions.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-IsolationID<Int32>

Specifies an ID of a virtual subnet. The cmdlet adds an ACL that applies to traffic on the isolated network that you specify. The subnet uses virtual local area network (VLAN) or Hyper-V Network Virtualization. For more information about isolation IDs, see the Set-VmNetworkAdapterIsolation cmdlet.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-LocalIPAddress<String>

Specifies the local IP address for the ACL. For an inbound packet, the local address is the destination IP address. For an outbound packet, the local address is the source IP address. You can specify a host address or a subnet address, or specify a wildcard, such as 0.0.0.0/0 for all IPv4 addresses, ::/0 for all IPv6 addresses, or ANY for all IPv4 and IPv6 addresses.

Alias

ninguno

¿Requerido?

false

¿Posición?

4

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-LocalPort<String>

Specifies the local port for the ACL. For an inbound TCP or UDP packet, the local port is the destination port. For an outbound packet, the local port is the source port.

Alias

ninguno

¿Requerido?

false

¿Posición?

6

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-ManagementOS

Indicates that the cmdlet operates on the parent or host operating system. If you specify this parameter, this cmdlet creates an ACL that applies to the parent or host operating system.

Alias

ninguno

¿Requerido?

true

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Passthru

Devuelve un objeto que representa el elemento con el que está trabajando. De forma predeterminada, este cmdlet no genera ningún resultado.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Protocol<String>

Specifies the protocol that the ACL applies to. Los valores aceptables para este parámetro son los siguientes:

-- TCP
-- UDP
-- ICMP
-- an integer IP protocol ID

Alias

ninguno

¿Requerido?

false

¿Posición?

8

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-RemoteIPAddress<String>

Specifies the local IP address for the ACL. For an inbound packet, the remote address is the source IP address. For an outbound packet, the remote address is the destination IP address. You can specify a host address or a subnet address, or specify a wildcard, such as 0.0.0.0/0 for all IPv4 addresses, ::/0 for all IPv6 addresses, or ANY for all IPv4 and IPv6 addresses.

Alias

ninguno

¿Requerido?

false

¿Posición?

5

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-RemotePort<String>

Specifies the remote port for the ACL. For an inbound TCP or UDP packet, the remote port is the source port. For an outbound packet, the remote port is the destination port.

Alias

ninguno

¿Requerido?

false

¿Posición?

7

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Stateful<Boolean>

Indicates whether the ACL applies to packets in both directions of the same session. If you specify a value of $True, the ACL applies to a return packet even though that packet has the opposite direction with respect to the ACL.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-VM<VirtualMachine[]>

Specifies an array of virtual machine objects. The cmdlet adds an ACL for the virtual machines that you specify. To obtain a virtual machine object, use the Get-VM cmdlet.

Alias

ninguno

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByValue)

¿Aceptar caracteres comodín?

false

-VMName<String[]>

Specifies an array of names of virtual machines. The cmdlet adds an ACL for the virtual machines that you specify.

Alias

ninguno

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByValue)

¿Aceptar caracteres comodín?

false

-VMNetworkAdapter<VMNetworkAdapterBase[]>

Specifies an array VM network adapters as VMNetworkAdapterBase objects. The cmdlet adds an ACL to the adapters that you specify. To obtain a network adapter, use the Get-VMNetworkAdapter cmdlet.

Alias

ninguno

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByValue)

¿Aceptar caracteres comodín?

false

-VMNetworkAdapterName<String>

Specifies the name of a virtual network adapter. The cmdlet adds an ACL to the adapter that you specify.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Weight<Int32>

Specifies the weight of an ACL entry. Larger weight values apply first, and once an ACL entry applies to a packet, other entries are no longer relevant for that packet.

Alias

ninguno

¿Requerido?

true

¿Posición?

9

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Confirm

Solicita confirmación antes de ejecutar el cmdlet.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-WhatIf

Muestra lo que sucedería si se ejecutara el cmdlet. El cmdlet no se ejecuta.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.

  • None

Salidas

El tipo de resultado es el tipo de objetos que emite el cmdlet.

  • Microsoft.HyperV.PowerShell.VMNetworkAdapterExtendedAclSetting

Ejemplos

Example 1: Create an ACL for Remote Desktop Protocol

This command creates a stateful inbound ACL that allows a remote device to connect to the virtual machine on port 3389, which is the port for Remote Desktop Protocol.

PS C:\> Add-VMNetworkAdapterExtendedAcl -VMName "TSQA01" -Action Allow -Direction Inbound -LocalPort "3389" -Protocol "TCP" -Weight 10 -Stateful $True

Example 2: Create an ACL to initiate a connection with timeout

This command creates a stateful ACL that allows outbound packets to a remote device by using TCP. If there is no activity for 3600 seconds, the connection times out.

PS C:\> Add-VMNetworkAdapterExtendedAcl -VMName "TSQA03" -Action Allow -Direction Outbound -RemotePort "80" -Protocol "TCP" -Weight 100 -Timeout 3600 -Stateful $True 

Temas relacionados

Get-VMNetworkAdapterExtendedAcl

Remove-VMNetworkAdapterExtendedAcl

Get-VM

Set-VmNetworkAdapterIsolation