Jump to content

Recommended Posts

Posted

Hi,

 

Is it possible to reset a computers ip from fixed to DHCP via a script/gp setting?

We are moving over curriculum this summer and making the whole site DHCP and didn't fancy resetting 200 admin machines :eek:

 

Thanks

Posted

i reckon so,

 

I've used a script to add WINS settings (using WMI)

 

e.g.

 

strComputer = args(0) 
changewins = args(1)

if args.count > 0 then

Set objWMIService = GetObject("winmgmts:\\" _
   & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
   "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True",,48) 

For Each objItem in colItems 
   
 	
	if (objItem.WINSPrimaryServer<>"") then

	  	 wscript.echo strcomputer & "--> " & objItem.WINSPrimaryServer & "," & objItem.WINSSecondaryServer _
			  & " - " & objItem.ipaddress(0)
		  'objItem.Description
	if changewins="YES" or changewins ="yes" then
	   	if (objItem.WINSPrimaryServer<>"192.168.0.5")then 
	       intSetWINSServer = objitem.SetWINSServer(strWINSPrimaryServer,strWINSSecondaryServer)
			   	If intSetWINSServer = 0 Then
   		 	   	WScript.Echo "    Successfully set WINS servers."
 				ElseIf intSetWINSServer = 1 Then
   				WScript.Echo "    Successfully set WINS servers BUT Must reboot."
 				Else
   				WScript.Echo "    Unable to set WINS servers."
			end if	
		end if  
	 
	 end if
			
	end if




Next


else 
 wscript.echo "To run this script:"
 wscript.echo "-------------------"
 wscript.echo VBCLF
 wscript.echo "c:\cscript winscheck.vbs  "
 wscript.echo "where YES (optional) applies to whether to change WINS settings"
 
end if	

  • Thanks 1
Posted

Thanks guys, ive done it like this and it's working perfectly :D

 

netsh interface ip set address "Local Area Connection" dhcp

 

netsh interface ip set address "Wireless Network Connection" dhcp

 

netsh interface ip set dns "Local Area Connection" dhcp

 

netsh interface ip set dns "Wireless Network Connection" dhcp

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...