+ Post New Thread
Results 1 to 5 of 5
Windows Thread, Automatically reset ip from fixed to DHCP via a script in Technical; Hi, Is it possible to reset a computers ip from fixed to DHCP via a script/ gp setting? We are ...
  1. #1

    Join Date
    Apr 2007
    Location
    Basingstoke
    Posts
    79
    Thank Post
    5
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Automatically reset ip from fixed to DHCP via a script

    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

    Thanks

  2. #2
    Diello's Avatar
    Join Date
    Jun 2005
    Location
    Kent, England
    Posts
    1,064
    Thank Post
    112
    Thanked 228 Times in 128 Posts
    Rep Power
    74
    netsh interface ip set address "Local Area Connection" dhcp

    ...should do it.

  3. Thanks to Diello from:

    Southwell (23rd May 2008)

  4. #3

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,804
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    Yep, you can use the 'netsh' command to do this. Here is a KB article on the subject.

    How to Use the NETSH Command to Change from Static IP Address to DHCP in Windows 2000

  5. Thanks to Geoff from:

    Southwell (23rd May 2008)

  6. #4
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,527
    Thank Post
    107
    Thanked 89 Times in 75 Posts
    Blog Entries
    46
    Rep Power
    40
    i reckon so,

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

    e.g.

    Code:
    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 <computername> <YES>"
    	 wscript.echo "where YES (optional) applies to whether to change WINS settings"
    	 
    end if

  7. Thanks to browolf from:

    Southwell (23rd May 2008)

  8. #5

    Join Date
    Apr 2007
    Location
    Basingstoke
    Posts
    79
    Thank Post
    5
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks guys, ive done it like this and it's working perfectly

    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

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 15
    Last Post: 28th August 2009, 09:55 AM
  2. Whats best, Fixed or Dynamic IP?
    By ninjabeaver in forum Wireless Networks
    Replies: 20
    Last Post: 19th February 2009, 07:01 PM
  3. Replies: 14
    Last Post: 27th March 2008, 04:57 PM
  4. FIXED: Server down temporarily
    By contink in forum EduGeek Joomla 1.0 Package
    Replies: 0
    Last Post: 9th March 2008, 04:05 PM
  5. Replies: 12
    Last Post: 12th September 2005, 10:47 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •