Ipauto [a script to easily set up the IP addresses of hundreds of machines] [allyesno]

Source: Internet
Author: User

Generally, when we create a network project for an enterprise or Internet cafe, we need to set up an IP address after the last ghost system.

It takes time to manually set IP addresses. Some people say that DHCP is not required for automatic allocation, because many enterprises and Internet cafes

Numbers are required for each server. Although DHCP assigns IP addresses sequentially, you never know if the assigned IP address is the corresponding IP address number.

So I wrote this script to complete the task, as long as the first three groups of subnet gateways and DNS of the IP address are modified in advance on the master disk.

The last group of IP addresses is entered as prompted. After the script is set, the system restarts and deletes the source program.

Cause Any security problems or faults

Below is the source program

@ Echo off
Del/F pcrename. vbs> NUL 2> NUL
Title ipauto 1.0 by allyesno http://blog.csdn.net/freexploit/
CLS
Echo function: automatically sets the subnet, gateway, DNS, and Computer Host Name.
Echo.
Echo example: 192.168.8.123, the Local Computer number is 123
Echo.
Set/p ip = enter the Local Computer Number:
Echo.
ECHO is setting IP address. It may take 5 minutes to wait ......

: The following subnet/gateway/IP address is changed to the IP address/subnet/gateway of the Internet cafe.

Netsh int IP Set Add name = "Local Connection" static 192.168.5.% IP % 255.255.0.0 192.168.5.1 0
Netsh int IP Set Add name = "Local Connection" static 192.168.5.% IP % 255.255.0.0 192.168.5.1 0
IP address set for Echo!
Echo.
ECHO is setting DNS. Please wait .....

: Change the following dns ip address to the dns ip address of the Internet cafe.

Netsh int IP Set DNS name = "Local Connection" Source = static 202.103.176.22
Netsh int IP add DNS name = "Local Connection" 202.103.176.28 Index = 2
DNS settings are complete for Echo!
Echo.
ECHO is setting the computer name. Please wait ......

: Modify the computer name Module

Echo set OBJ = GetObject ("winmgmts: //./root/cimv2")> pcrename. vbs
Echo set list = obj.exe cquery ("select * From win32_computersystem")> pcrename. vbs
Echo for each X in List> pcrename. vbs
Echo X. Rename (wscript. Arguments. Item (0)> pcrename. vbs
Echo next> pcrename. vbs

: The company number below should be changed to the computer name of the Internet cafe.

Cscript // nologo pcrename. vbs company No. % IP %
Echo.
Echo: The computer name has been set!
Echo.
Echo now restarts the system to make the NIC settings take effect
Shutdown-r-F-T 10
Del/F pcrename. vbs
Del % 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.