The following script will scan all network adapters on a windows PC and modify any with IP Enabled devices to use DHCP and DNS from DHCP.

This script must be run with administrative privileges. 

'-----------------------------------------------------------------------
'---This script is provided to assist setting network connections to ---
'---DHCP.  All connections with a non-blank NetConnectionID will be  ---
'---set to DHCP.                                                     ---
'---                                                                 ---
'---Please use with caution.  This script is provided without any    ---
'---warranty or guarantee.                                           ---
'---                                                                 ---
'---Authors: Josh Barton                                             ---
'---Date Updated: 1/08/2015                                          ---
'-----------------------------------------------------------------------

'Option Explicit

On Error Resume Next

Dim strClass
Dim strNetAdapterLabel
Dim objItem
Dim strRC
Dim intRC
Dim colItems
Dim output

'---Get date to add to log information
Dim strDate
strDate = Now

Dim address
address = "localhost"

Set wmiService = GetObject("winmgmts:\\" & address & "\root\CIMV2")

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
 
Const PATH_TO_OUTPUT = "C:\NetAdapterToDHCPLog.txt"
Const ForReading = 1, ForWriting = 2, ForAppending = 8 
 
Dim fso
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
 
Dim shl
Set shl = WScript.CreateObject("WScript.Shell")


'---Serialization and Test
Const SERIAL_NUMBER = "00000001"
Dim strCurRegSerial 
Dim bKey

bKey = shl.RegRead("HKCU\AETHERSCRIPTING\NetAdaptersToDHCP\")
strCurRegSerial = shl.RegRead("HKCU\AETHERSCRIPTING\NetAdaptersToDHCP\SerialNumber")

IF strCurRegSerial = SERIAL_NUMBER Then
	'---Script has already run on this PC, Exit script before any changes are applied again.
	'WScript.Echo "Script has already run and will now exit."
	WScript.Quit
Else
	'---Add/Update Serial Number if it does not match and continue to run
	'WScript.Echo "Script has changed or has not yet run and will now execute."
	shl.RegWrite "HKCU\AETHERSCRIPTING\NetAdaptersToDHCP\", 1, "REG_BINARY"
	shl.RegWrite "HKCU\AETHERSCRIPTING\NetAdaptersToDHCP\SerialNumber", SERIAL_NUMBER, "REG_SZ"
End If




 
If (fso.FileExists(PATH_TO_OUTPUT)) Then
	' Open for appending
	Set output = fso.OpenTextFile(PATH_TO_OUTPUT, ForAppending, True)
	output.WriteLine ""
	output.WriteLine "----BEGIN Execution of NetAdaptersToDHCP - " & strDate
Else
	' Create and Open new file
	Set output = fso.CreateTextFile(PATH_TO_OUTPUT, True)
	output.WriteLine "----BEGIN Execution of NetAdaptersToDHCP - " & strDate
End If


'---List all information about a specific class
		strClass = "Win32_NetworkAdapter"

		Set colItems = wmiService.ExecQuery( "SELECT * FROM " & strClass, "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly )
		For Each objItem In colItems
			'---Only grab network adapters with a non-blank NetConnectionID
			If objItem.NetConnectionID <> "" Then
				'---Get Current adapter ID
				strNetAdapterLabel = objItem.NetConnectionID
				
				'---Set current adapter to DHCP
				strRC = "netsh interface ip set address " & Chr(34) & strNetAdapterLabel & Chr(34) & " dhcp"
				'WScript.echo "Debug command: " & strRC
				intRC = shl.Run(strRC, 0, TRUE)
				
				'---Write to log the executed command
				output.WriteLine "Adapter: " & objItem.DeviceID & " (" & strNetAdapterLabel & ") will be set to DHCP..."
				output.WriteLine "Exec: " & strRC
				If intRC = 0 Then
					output.WriteLine "Status: Success!"
				Else
					output.WriteLine "Status: Failed.     error code: " & intRC 
					output.WriteLine "Status: Is DHCP already enabled?"
				End If
				
				
				'---Set current adapter to set DNS from DHCP
				strRC = "netsh interface ip set dnsservers " & Chr(34) & strNetAdapterLabel & Chr(34) & " source=dhcp"
				'WScript.echo "Debug command: " & strRC
				intRC = shl.Run(strRC, 0, TRUE)
				
				'---Write to log the executed command
				output.WriteLine "Adapter: " & objItem.DeviceID & " (" & strNetAdapterLabel & ") will be set to use DNS from DHCP..."
				output.WriteLine "Exec: " & strRC
				If intRC = 0 Then
					output.WriteLine "Status: Success!"
				Else
					output.WriteLine "Status: Failed.     error code: " & intRC 
					output.WriteLine "Status: Is DNS from DHCP already enabled?"
				End If
			Else
				'---Write to log the adapter that was skipped
				output.WriteLine "Adapter: " & objItem.DeviceID & " Skipped..."
			End If

		Next
	   
		'WScript.Echo "Complete"
		
		'---update strDate and close log file
		strDate = Now
		output.WriteLine "----END Execution of NetAdaptersToDHCP - " & strDate
		output.Close