Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Hosting and Servers
  4. How to Reset IP address from static IP address to dynamic IP Address everytime when a User reboots the system?

How to Reset IP address from static IP address to dynamic IP Address everytime when a User reboots the system?

Scheduled Pinned Locked Moved Hosting and Servers
toolshelptutorialquestion
4 Posts 3 Posters 15 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13966314
    wrote on last edited by
    #1

    I am new to networking and i am curious to find a way to write a script so that when the system IP address is set static, it must set back to dynamic IP address automatically when the system reboots. so I learnt how to do it manually but its a set of 30 Systems so i want to know if there is a way to write a script such that if the system has a static IP address it should be set back to dynamic IP address when the system reboots. Is it possible to do this? Please let me know. Any help is much appreciated. Thank you :)

    Richard DeemingR J 2 Replies Last reply
    0
    • U User 13966314

      I am new to networking and i am curious to find a way to write a script so that when the system IP address is set static, it must set back to dynamic IP address automatically when the system reboots. so I learnt how to do it manually but its a set of 30 Systems so i want to know if there is a way to write a script such that if the system has a static IP address it should be set back to dynamic IP address when the system reboots. Is it possible to do this? Please let me know. Any help is much appreciated. Thank you :)

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      From the command-line, you can use netsh to change back to a DHCP address:

      netsh interface ip set dns "Local Area Connection" dhcp

      Netsh commands for Interface IP | Microsoft Docs[^] You'll need to know the name of the interface you're changing. From C# or PowerShell, you can use WMI: networking - C# - enable / disable DHCP - Stack Overflow[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      U 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        From the command-line, you can use netsh to change back to a DHCP address:

        netsh interface ip set dns "Local Area Connection" dhcp

        Netsh commands for Interface IP | Microsoft Docs[^] You'll need to know the name of the interface you're changing. From C# or PowerShell, you can use WMI: networking - C# - enable / disable DHCP - Stack Overflow[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        U Offline
        U Offline
        User 13966314
        wrote on last edited by
        #3

        Thank You Richard. I will research on that.Thanks for the heads up :thumbsup: :)

        1 Reply Last reply
        0
        • U User 13966314

          I am new to networking and i am curious to find a way to write a script so that when the system IP address is set static, it must set back to dynamic IP address automatically when the system reboots. so I learnt how to do it manually but its a set of 30 Systems so i want to know if there is a way to write a script such that if the system has a static IP address it should be set back to dynamic IP address when the system reboots. Is it possible to do this? Please let me know. Any help is much appreciated. Thank you :)

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          Been a while but I am pretty sure that you can configure your DHCP server to require that the IP change. Basically the client computer asks for a new IP from the DHCP server and it is allowed to suggest a prior one. The DHCP server and accept that request or reject it and send back the one it wants. So one can set up a rule in the DHCP server that forces a new IP based on other criteria. That means nothing the client does, normally, would allow it to 'set' a static IP. Even if a user sets it up that way the DHCP would refuse. At least at one time this was a common security constraint.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups