1

How can I set a remote computer to use DHCP instead of a static IP address?

I have tried using Set-NetIPInterface -DHCP Enabled however this requires WinRM which is disabled on my network.

How can I do it using a built in Windows technology like Netsh (I can't download PSExec).

David Klempfner
  • 195
  • 2
  • 13
  • Depending on the client version, you may have to use netsh anyway, the Net cmdlets require Windows 8 or newer, or Server 2012 or newer, as those cmdlets are part of the OS. – Davidw Aug 09 '17 at 02:18
  • I'm using Server 2012. But it doesn't matter because WinRM is disabled. – David Klempfner Aug 09 '17 at 02:24
  • Can you explain your whole scenario a little better? This sounds like a very in-the-weeds question, and you might get a more useful answer if you explain the entire problem that you're facing. – mfinni Aug 10 '17 at 02:05

1 Answers1

1

WMI works well:

$networkAdapterConfig = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName 'SomeComputerName'
$networkAdapterConfig.EnableDhcp()
David Klempfner
  • 195
  • 2
  • 13