In some cases, you may need to switch your server's IP address from static, as you did in the Configuring IP addressing recipe, back to DHCP. You might need to do this to re-purpose a server. You may have given it a static IP address to perform a role, but you plan to re-purpose this server and want to configure the server to obtain IP configuration from DHCP.
Run this recipe on the DC2
server. Of course, after running and testing this recipe, you may need to re-run the Configure IP address recipe to ensure DC2
remains correctly configured.
- Get the existing IP address information:
$IPType = 'IPv4'$Adapter = Get-NetAdapter | ? {$_.Status -eq 'up' }$Interface = $Adapter | Get-NetIPInterface -AddressFamily $IPType$IfIndex = $Interface.ifIndex$IfAlias = $Interface.InterfacealiasGet-NetIPAddress -InterfaceIndex $Ifindex ` -AddressFamily $IPType
- Set the interface to get its address from DHCP:
Set...