SynopsisRemoves the specified gateway address from the network adapter on a local or remote computer.
- Remove-NetworkAdapterGateway [-Name] [-Gateway] [-ComputerName] [-Credential]
- Remove-NetworkAdapterGateway [-MACAddress] [-Gateway] [-ComputerName] [-Credential]
DescriptionThe Remove-NetworkAdapterGateway cmdlet is used to remove gateway addresses from a network adapter on a local or remote computer. Adapters can be identified by name or MAC address.
- Name The name of the network adapter to configure. This parameter cannot be used when the MACAddress parameter has been specified.
- MACAddress The MAC address of the network adapter to configure. This parameter cannot be used when the name parameter has been specified.
- Gateway The gateway address to remove.
- ComputerName The computer against which to run the cmdlet. By default this cmdlet will be populated with the name of the local computer.
- Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.
InputsRemove-NetworkAdapterGateway accepts the output of Get-NetworkAdapter as an input object. The Name, MACAddress and ComputerName parameters each accept pipeline input by property name.
OutputsRemove-NetworkAdapterGateway makes changes directly to Windows and does not output any Powershell objects.
NotesThe Remove-NetworkAdapterGateway cmdlet requires that the Remote Registry and RPC services are started on the computer it is trying to access and that DNS services are available to resolve target host names.
Example 1This command will remove the gateway 192.168.0.44 from the adapter "Local Area Connection" on the local computer:
C:\PS>Remove-NetworkAdapterGateway "Local Area Connection" -gateway 192.168.0.44
Example 2This command will remove the gateway 192.168.0.44 from the adapter "Local Area Connection" on the remote computer PC01:
C:\PS>Remove-NetworkAdapterGateway "Local Area Connection" -gateway 192.168.0.44 -computer PC01
Example 3Remove-NetworkAdapterGateway can also be used in conjunction with the Get-NetworkAdapter cmdlet. In this example Get-NetworkAdapter fetches all the network adapters on the remote computer PC01 and Remove-NetworkAdapterGateway removes the gateway address 192.168.1.44 from the configuration of each adapter:
C:\PS>Get-NetworkAdapter -Computer PC01 | Remove-NetworkAdapterGateway 192.168.1.44