1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

DHCP Policy

Discussion in 'Networking' started by EvilSoldier, Jul 20, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. EvilSoldier

    EvilSoldier Thread Starter

    Joined:
    Apr 22, 2006
    Messages:
    9
    Hi,
    Is there a way when I log on in my Windows 2000 Session to set up my computer to "Obtain an Ip address automatically" and by the same removing the static ip address if there's one.

    I have a Win2k Server that is linked to many computers that have Win2k on a domain.

    I don't know if it exists a policy that can change this setting.

    Thanks to help me.
     
  2. Rollin' Rog

    Rollin' Rog

    Joined:
    Dec 9, 2000
    Messages:
    45,855
    Is this what you mean (see attachment)?
     

    Attached Files:

  3. EvilSoldier

    EvilSoldier Thread Starter

    Joined:
    Apr 22, 2006
    Messages:
    9
    Yes. Does it have, in Win2k, a (user/group) policy that put this setting automatically ?
     
  4. Rollin' Rog

    Rollin' Rog

    Joined:
    Dec 9, 2000
    Messages:
    45,855
    That I don't know. My guess is that you have to set it up individually for each connection since it applies to the LAN network, not the user.

    Although if you are using a router -- I believe you may find a global setting there which may take precedence.

    Anyway, I'll move this to the networking forum where I think this is probably best addressed.
     
  5. Ablack86

    Ablack86

    Joined:
    Jan 12, 2006
    Messages:
    275
    How many computers are we talking?
    just out of curiosity.
     
  6. EvilSoldier

    EvilSoldier Thread Starter

    Joined:
    Apr 22, 2006
    Messages:
    9
    No problem for moving this topic to Networking forum.

    About the number, 200 computers so that's why I was asking this. :)

    It's not urgent but it would be preferable to find something 'cause it could help me to save a lot of time. Actually, we don't remember which computer that we put a static IP. Long story anyway. If a policy don't existing for what I want, is there a way to find computers that have a Static IP address and DHCP Ip address in windows.

    Thanks for your help
     
  7. Ablack86

    Ablack86

    Joined:
    Jan 12, 2006
    Messages:
    275
    You could see if a reservation was made for the computer that was staticly assigned the IP...
     
  8. Memnoch322

    Memnoch322

    Joined:
    May 10, 2005
    Messages:
    880
    Look at your scope, that is the range defined on the DHCP server? once you have the range of the DHCP server use an IP scanner to scan the whole subnet. The IP address that respond and are not in the range of the scope are most likly going to be static.
     
  9. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,418
    I'd almost be so bold as to say that the addresses that appear outside the range of the DHCP server are bound to be statically assigned! :D

    You could also have static addresses assigned within the DHCP address range, so if you dump the DHCP server's assignments and sort them in a spreadsheet, you can see if any other addresses not represented show up in an IP scan of the network.
     
  10. StumpedTechy

    StumpedTechy

    Joined:
    Jul 7, 2004
    Messages:
    7,234
    If your running Windows XP you can use the netsh commands and dump it into a startup script script. Using this you should easily be able to remove all static IP addresses with no problem.

    netsh interface ip set address "Local Area Connection" dhcp - http://support.microsoft.com/?kbid=257748
    netsh set dns "Local Area Connection" dhcp

    Also doing this anything that is currently set to obtain it automatically would stay that way.

    Another way to do it is one by 1 -

    Here is a VBS code that will reset all adapters on any Machine to Obtain automatically -

    Code:
    '--------------------------------------------------------------------
    'Change XP PCs IP and DNS from Static to DHCP.vbs
    'Written by:Eric Theisen 11/18/05
    'Last Modified:
    'This script will prompt you for a computer name then it runs WMI on
    'the computername and then will reset all Adapters with TCP/IP bound
    'to it and sets all adapters TCP/IP to DHCP enabled and DNS from DHCP.
    '---------------------------------------------------------------------
    On Error Resume Next
    strComputer = InputBox("Type in the Computer Name","Computer Name Variable")
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    
    Set colNetAdapters = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
    
    For Each objNetAdapter In colNetAdapters
    errEnable = objNetAdapter.EnableDHCP()
    objNetAdapter.SetDNSServerSearchOrder()
    objNetAdapter.SetDynamicDNSRegistration FULL_DNS_REGISTRATION, _
    DOMAIN_DNS_REGISTRATION
    NEXT
    Please remember that doing this over a network will cause a brif interupption of about 1 min for the shange to occur and the new DHCP lease to be aquired.
     
  11. Couriant

    Couriant Trusted Advisor

    Joined:
    Mar 26, 2002
    Messages:
    32,596
    First Name:
    James
    Yeah I was thinking a logon script to do that, but it could cause problems and would probably require a reboot anyways... :)

    Good luck!
     
  12. EvilSoldier

    EvilSoldier Thread Starter

    Joined:
    Apr 22, 2006
    Messages:
    9
    First, Will it work if I use this code on Win2k computer ?
    Second, "winmgmts:{impersonationLevel=impersonate}!", what is impersonationLevel and winmgmts ? (maybe it could help me for another program that i've done.)
    Third, Is there a way to take ONLY the onboard adapter in this query ?
    Code:
     Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE 
    Thanks

     
  13. StumpedTechy

    StumpedTechy

    Joined:
    Jul 7, 2004
    Messages:
    7,234
    I believe it should though we are a 100% XP shop on the domain so I really have not tried. theoretcially it should work fine though I owuld run 1 single test subject first. The API's and WMI are all in W2K that are in XP for the parts that are called (I believe)

    The winmgmts is the WMI and the impersonate level is whats set to allow passing of the API calls. if you don't then you can't pass alon the information.
    http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_jgfx.mspx?mfr=true
    http://spyxkb.stbernard.com/webhelp/Troubleshooting/Tasks/XCMConfig/SX0017.htm

    Well really you could do it for anything within the Win32_NetworkAdapter setup - Check this -http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_networkadapterconfiguration.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_networkadapter.asp for things you can usethe * just is an all.

    If all your onboards have a specific device ID you can use that... Really it depends on the environment as to which of all these many selections you have I would use.
     
  14. StumpedTechy

    StumpedTechy

    Joined:
    Jul 7, 2004
    Messages:
    7,234
    Oh an just as an FYI Tidus if this was put into a startup script this should occur even before the login script and should not even force a reboot to happen. Changing an adapter to DHCP from static requires no reboot thus shouldn't interfere with anything as long as the processing is done before PC loging to the network or after but before the user starts to actually work. The only times there can be consequences to this is 1 if there is something that is connecting at the time the script is running. or if the user is working on something that requires a constant network connection.

    THings like web browsing and email (off an exchange server) and things of this nature should not have any types of problems.
     
  15. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - DHCP Policy
  1. Malikquy
    Replies:
    4
    Views:
    641
  2. NateRD82
    Replies:
    23
    Views:
    753
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/484773

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice