Windows Client Management: Remotely Enable DHCP

Windows Client Management: Remotely Enable DHCP

Using WMI and Powershell we can remotely configure a client machine to use DHCP as long as you (1) have administrator rights on the remote machine (2) want all interfaces to be DHCP (3) know the computer name or IP of the remote machine (4) have Powershell installed on your machine, remote machine is not required.

Check Network Configuration

PS> Get-WmiObject -ComputerName RemoteComputerNameOrIP -Class Win32_NetworkAdapterConfiguration

Check Network Configuration (only where IP is enabled)

PS> Get-WmiObject -ComputerName RemoteComputerNameOrIP -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=true

Configure DHCP for All Network Connections with IP Enabled

PS> Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=true -ComputerName RemoteComputerNameOrIP | ForEach-Object -Process {$_.InvokeMethod("EnableDHCP", $null)}