Announcement

Collapse
No announcement yet.

Static to DHCP IP Addressing changes company wide

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Static to DHCP IP Addressing changes company wide

    Hi All,

    At the moment my company is using a static IP address assigned to every PC and Laptop, all of them managed by Windows Server 2003 DNS Server which is AD Integrated DC +GC

    Over the weekend I'm about to use DHCP company wide and just wondering where should i set to make automatic company wide Static to DHCP IP addressing changes ?

    Any suggestion would be greatly appreciated.

    Thanks.

  • #2
    Re: Static to DHCP IP Addressing changes company wide

    1. You need to install DHCP on your server.

    2. You need to create a DHCP scope for your subnet.

    3. You need to set the appropriate DHCP scope options, such as router, DNS servers, etc.

    4. You need to configure all of your computers to use DHCP instead of using the static ip addresses.

    Comment


    • #3
      Re: Static to DHCP IP Addressing changes company wide

      Hi Joe,

      Yes step 1-3 done that already but I haven't activated my DHCP yet as I'm still don't know what to do on step 4.

      should I go and tell everyone in the company to make the IP Addressing configuration changes or there is a script that can be configured as the "logon" script that i can put into the GPO ?

      Comment


      • #4
        Re: Static to DHCP IP Addressing changes company wide

        You can go ahead and activate the scope, it won't do any harm. Then you could write a logon script to change from static to dynamic with this (from enterpriseitplanet.com):

        Code:
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colNetAdapters = objWMIService.ExecQuery _
        ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
        For Each objNetAdapter In colNetAdapters
        errEnable = objNetAdapter.EnableDHCP()
        If errEnable = 0 Then
        Wscript.Echo "DHCP has been enabled."
        Else
        Wscript.Echo "DHCP could not be enabled."
        End If
        Next


        Run this on your computer as a test. If it works OK then roll it out as part of your logon script.
        Last edited by biggles77; 18th June 2009, 03:27. Reason: Wrap text in CODE

        Comment


        • #5
          Re: Static to DHCP IP Addressing changes company wide

          Great advice from joeqwerty again.

          Just my 2 cents worth.

          You can also use netsh to enable dhcp on machines.

          netsh interface ip set address "Local Area Connection" dhcp

          Comment


          • #6
            Re: Static to DHCP IP Addressing changes company wide

            TY Wullieb1. I was going to suggest netsh but as you need to know the interface name and Windows can be kind of funny about that I didn't know if a catch-all of "Local Area Connection" would work for all of the OP's computers.

            OP: You can always try netsh first as this might work out the best and will probably catch the majority of your client computers.

            Comment


            • #7
              Re: Static to DHCP IP Addressing changes company wide

              Ok,

              thanks for the response guys, I now learned two things,:

              by using netsh, we have to be exactly sure that all Network connection is still "Local Area Connection", thus things can be tricky if the client actually does have more than one LAN connection and renamed the default connection name.

              so the universal solution is that by executing the VBScript after saved as dhcp.vbs
              C:\ wscript dhcp.vbs

              CMIIW

              Comment


              • #8
                Re: Static to DHCP IP Addressing changes company wide

                Hey joe,

                From memory there used to be a scirpt that cycled your LAN cards to check for the name then run the netsh command.

                Been a lonnnnnnnng time since i used it though.

                Comment


                • #9
                  Re: Static to DHCP IP Addressing changes company wide

                  Sorry, I'm not familiar with it.

                  Comment


                  • #10
                    Re: Static to DHCP IP Addressing changes company wide

                    Hi All,

                    I'm stuck in executing the script below as dhcp.vbs:

                    ---------------------------------------------------------------------------------------------------------------
                    Code:
                    strComputer = "."
                    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
                    Set colNetAdapters = objWMIService.ExecQuery _
                    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
                    For Each objNetAdapter In colNetAdapters
                       errEnable = objNetAdapter.EnableDHCP()
                       If errEnable = 0 Then
                           Wscript.Echo "DHCP has been enabled."
                       Else
                           Wscript.Echo "DHCP could not be enabled."
                       End If
                    Next
                    -------------------------------------------------------------------------------------------------------------
                    Error Message:
                    Code:
                    W:\SOE\_TOOLS\SysinternalsSuite>psexec.exe \\TargetPC -u MyDomain\administrator -p AdminPassword "c:\windows\system32\cscript.exe \\FileServer\PCAPPS\SOE\_TOOLS\SysinternalsSuite\dhcp.vbs"
                     
                    PsExec v1.94 - Execute processes remotely
                    Copyright (C) 2001-2008 Mark Russinovich
                    Sysinternals - www.sysinternals.com
                     
                    Starting c:\windows\system32\cscript.exe \\FileServer\PCAPPS\SOE\_TOOLS\Sysinternal
                     
                    PsExec could not start c:\windows\system32\cscript.exe \\FileServer\PCAPPS\SOE\_TOOLS\SysinternalsSuite\dhcp.vbs on TargetPC:
                    The system cannot find the path specified.
                     
                    W:\SOE\_TOOLS\SysinternalsSuite>
                    any suggestion in executing the script please ?

                    Thanks.

                    Comment


                    • #11
                      Re: Static to DHCP IP Addressing changes company wide

                      Try removing the quotes.

                      Comment


                      • #12
                        Re: Static to DHCP IP Addressing changes company wide

                        Hi Joe,

                        yes, you're right

                        Code:
                        PsExec v1.94 - Execute processes remotely
                        Copyright (C) 2001-2008 Mark Russinovich
                        Sysinternals - www.sysinternals.com
                        
                        
                        Microsoft (R) Windows Script Host Version 5.7
                        Copyright (C) Microsoft Corporation. All rights reserved.
                        
                        Error communicating with PsExec service on TargetPC:
                        The specified network name is no longer available.
                        and it still doesn't like the UNC path of my shared folder

                        Comment


                        • #13
                          Re: Static to DHCP IP Addressing changes company wide

                          Well I've never used psexec so what if you try running just the script (logged on as Administrator) to see if it works. If it does then you'll know that psexec is the problem and not the script. That way you'll be able to focus your troubleshooting on getting psexec to work correctly.

                          Comment


                          • #14
                            Re: Static to DHCP IP Addressing changes company wide

                            Hi,

                            thanks to all for the reply, this will be my first step to change all of the office machine IP address.

                            1. get all workstation IP registered using DHCP (Using VBScript).
                            2. set the server IP manually into new IP addressing scheme (don't know what to do with the DNS Servers, Exchange and DC ).
                            3. change the IP addressing scope from DHCP and let it replicate.

                            am I missing something here ?

                            Comment


                            • #15
                              Re: Static to DHCP IP Addressing changes company wide

                              Could you be more specific with items 2 and 3? I'm not clear on what you mean.

                              Comment

                              Working...
                              X