How to change a network card to dhcp remotely
Change one or more remote computers network card from a static address to dhcp a DHCP address
# Create a list of computers # $computers = ('computer1','computer2','computer3') foreach ($comp in $computers){ # Get the active network card, if there is more than one active card you will need to adapt this script # $Netcard = Get-WMIObject Win32_NetworkAdapterConfiguration -computername $comp | where{ $_.IPEnabled -eq “TRUE”} # Clear the DNS server ip's so that it can retrieve a fresh list from DHCP # $netcard.SetDNSServerSearchOrder() # Enable DHCP on the network card # $netcard | ForEach-Object -Process {$_.EnableDHCP()} }