編輯

共用方式為


Remove-VMNetworkAdapterAcl

Removes an ACL applied to the traffic through a virtual network adapter.

Syntax

Remove-VMNetworkAdapterAcl
      [-VMNetworkAdapterName <String>]
      [-CimSession <CimSession[]>]
      [-ComputerName <String[]>]
      [-Credential <PSCredential[]>]
      [-VMName] <String[]>
      -Action <VMNetworkAdapterAclAction>
      -Direction <VMNetworkAdapterAclDirection>
      [-LocalIPAddress <String[]>]
      [-LocalMacAddress <String[]>]
      [-RemoteIPAddress <String[]>]
      [-RemoteMacAddress <String[]>]
      [-Passthru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-VMNetworkAdapterAcl
      [-VMNetworkAdapter] <VMNetworkAdapterBase[]>
      -Action <VMNetworkAdapterAclAction>
      -Direction <VMNetworkAdapterAclDirection>
      [-LocalIPAddress <String[]>]
      [-LocalMacAddress <String[]>]
      [-RemoteIPAddress <String[]>]
      [-RemoteMacAddress <String[]>]
      [-Passthru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-VMNetworkAdapterAcl
      [-ManagementOS]
      [-VMNetworkAdapterName <String>]
      [-CimSession <CimSession[]>]
      [-ComputerName <String[]>]
      [-Credential <PSCredential[]>]
      -Action <VMNetworkAdapterAclAction>
      -Direction <VMNetworkAdapterAclDirection>
      [-LocalIPAddress <String[]>]
      [-LocalMacAddress <String[]>]
      [-RemoteIPAddress <String[]>]
      [-RemoteMacAddress <String[]>]
      [-Passthru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-VMNetworkAdapterAcl
      [-VMNetworkAdapterName <String>]
      [-VM] <VirtualMachine[]>
      -Action <VMNetworkAdapterAclAction>
      -Direction <VMNetworkAdapterAclDirection>
      [-LocalIPAddress <String[]>]
      [-LocalMacAddress <String[]>]
      [-RemoteIPAddress <String[]>]
      [-RemoteMacAddress <String[]>]
      [-Passthru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-VMNetworkAdapterAcl
      [-InputObject] <VMNetworkAdapterAclSetting[]>
      [-Passthru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-VMNetworkAdapterAcl cmdlet removes an ACL applied to the traffic through a virtual network adapter.

Examples

Example 1

PS C:\> Remove-VMNetworkAdapterAcl -VMName Redmond -RemoteIPAddress 0.0.0.0/0 -Direction Both -Action Allow

Removes from virtual machine Redmond the ACL allowing any IPv4 traffic sent from or to the virtual machine.

Example 2

PS C:\> Remove-VMNetworkAdapterAcl -VMName Redmond -RemoteIPAddress ::/0 -Direction Both -Action Allow

Removes from virtual machine Redmond the ACL that allows any IPv6 traffic sent from and to the virtual machine.

Example 3

PS C:\> Remove-VMNetworkAdapterAcl -VMName Redmond -RemoteMacAddress 03-0f-01-0e-aa-b2 -Direction Both -Action Deny

Removes the MAC ACL to prevent virtual machine Redmond from sending traffic to or receiving traffic from a remote device with MAC address 03-0f-01-0e-aa-b2.

Example 4

PS C:\> Get-VMNetworkAdapterAcl -VMName Redmond | Remove-VMNetworkAdapterAcl

Retrieves all the port ACLs configured for virtual machine Redmond and pipelines them to Remove-VMNetworkAdapterAcl, which removes all of them from the virtual machine.

Parameters

-Action

Specifies the action of the ACL to be removed. Allowed values are Allow, Deny, and Meter.

Type:VMNetworkAdapterAclAction
Accepted values:Allow, Deny, Meter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

Specifies one or more Hyper-V hosts on which the ACL applied to a virtual machine network adapter is to be removed. NetBIOS names, IP addresses, and fully qualified domain names are allowable. The default is the local computer. Use localhost or a dot (.) to specify the local computer explicitly.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Type:PSCredential[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Direction

The direction of the network traffic (from the perspective of the virtual machine) to which the ACL applies. Allowed values are Inbound, Outbound, or Both.

Type:VMNetworkAdapterAclDirection
Accepted values:Inbound, Outbound, Both
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specifies the ACL to be removed.

Type:VMNetworkAdapterAclSetting[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-LocalIPAddress

Specifies the local IP address. It can be either IPv4 or IPv6 address. It can be either a host address or a subnet address, e.g. 1.2.3.4, 2001::2008, 192.168.1.0/24, or f001:f002:f003:f004::1/64.the IP address can also be a wildcard, 0.0.0.0/0 for all IPv4 addresses, ::/0 for all IPv6 addresses, or ANY for all IPv4 and IPv6 addresses.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LocalMacAddress

Specifies the local MAC address (e.g. 00-ab-00-11-22-33). Use the wildcard ANY to specify all MAC addresses.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ManagementOS

Specifies that the ACL is to be removed from the management (e.g. the parent, or host) operating system.

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

-Passthru

Specifies that a Microsoft.HyperV.PowerShell.VMNetworkAdapterAclSetting object is to be passed through to the pipeline representing the ACL to be removed.

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

-RemoteIPAddress

Specifies the remote IP address. . It can be either IPv4 or IPv6 address. It can be either a host address or a subnet address, e.g. 1.2.3.4, 2001::2008, 192.168.1.0/24, or f001:f002:f003:f004::1/64. the IP address can also be a wildcard, 0.0.0.0/0 for all IPv4 addresses, ::/0 for all IPv6 addresses, or ANY for all IPv4 and IPv6 addresses.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoteMacAddress

Specifies the remote MAC address. . It can be a host MAC address, e.g. 00-ab-00-11-22-33, or a wildcard, ANY, for all MAC addresses.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VM

Specifies the virtual machine from which the ACL is to be removed.

Type:VirtualMachine[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMName

Specifies the name of the virtual machine from which the ACL is to be removed.

Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMNetworkAdapter

Specifies the virtual machine network adapter from which ACL is to be removed.

Type:VMNetworkAdapterBase[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMNetworkAdapterName

Specifies the name of the virtual machine network adapter from which the ACL is to be removed.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

None by default, Microsoft.HyperV.PowerShell.VMNetworkAdapterAclSetting if PassThru is specified.