SynopsisRequests and configures a DHCP address for a network adapter on a local or remote machine.
- Request-NetworkAdapterDHCPAddress [-Name] [-ComputerName] [-Credential]
- Request-NetworkAdapterDHCPAddress [-MACAddress] [-ComputerName] [-Credential]
DescriptionThe Request-NetworkAdapterDHCPAddress cmdlet is used to enable DHCP on a network adapter on a local or remote computer. If DHCP is already enabled on the adapter, the DHCP lease is renewed. 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.
- 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.
InputsRequest-NetworkAdapterDHCPAddress accepts the output of Get-NetworkAdapter as an input object. The Name, MACAddress and ComputerName parameters each accept pipeline input by property name.
OutputsRequest-NetworkAdapterDHCPAddress makes changes directly to Windows and does not output any Powershell objects.
NotesThe Request-NetworkAdapterDHCPAddress 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 enable DHCP on the adapter Local Area Connection on the local computer:
C:\PS> Request-NetworkAdapterDHCPAddress "Local Area Connection"
Example 2This command will enable DHCP on the adapter Local Area Connection on the remote computer PC01:
C:\PS> Request-NetworkAdapterDHCPAddress "Local Area Connection" -Computer PC01
Example 3Request-NetworkAdapterDHCPAddress can be used in conjunction with the Get-NetworkAdapter cmdlet. This command will fetch all network adapters in the local computer and enable DHCP on each:
C:\PS> Get-NetworkAdapter | Request-NetworkAdapterDHCPAddress