Batch Script For Static and DHCP

Home Forums Scripting General Scripting Batch Script For Static and DHCP

Viewing 1 post (of 1 total)
  • Author
    Posts

  • Kobe 310
    Member
    #159921

    I need to switch between 2 diffrent networks, one gives out dhcp the other doesn’t. I have tried over 10 scripts that i’ve gotten online, none of them work.

    ex.

    netsh interface ipv4 set address “Local Area Connection 2” static 10.1.10.46
    netsh interface ip add dns “Local Area Connection 2” 4.2.2.2 8.8.8.8

    ex.

    netsh interface ip set address name=”Local Area Network Connection” source=dhcp
    netsh interface ip set dns name=”Local Area Network Connection” source=dhcp register=primary
    netsh interface ip set wins name=”Local Area Network Connection” source=dhcp

    ex.

    netsh int ip set address name = “Local Area Connection 2” source = static addr = 10.1.10.74 mask = 255.255.255.0 gateway= 10.1.10.1

    Any Ideas?

    Thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Don't leave your business open to attack! Come learn how to protect your AD in this FREE masterclass!REGISTER NOW - Thursday, December 2, 2021 @ 1 pm ET

Active Directory (AD) is leveraged by over 90% of enterprises worldwide as the authentication and authorization hub of their IT infrastructure—but its inherent complexity leaves it prone to misconfigurations that can allow attackers to slip into your network and wreak havoc. 

Join this session with Microsoft MVP and MCT Sander Berkouwer, who will explore:

  • Whether you should upgrade your domain controllers to Windows Server
    2019 and beyond
  • Achieving mission impossible: updating DCs within 48 hours
  • How to disable legacy protocols and outdated compatibility options in
    Active Directory

Sponsored by: