Script/Batch File inclining static IP Address?

mfeatherstone2

Prominent
Sep 21, 2017
2
0
510
Looking for a way to set network setting on multiple computers with different IPs without having to manually change the IP address in the batch file for the next computer so they dont conflit,
so basicly the 192.168.0.1 would become 192.168.0.2 after the file was run...

netsh interface ip set address "Local Area Connection" static 192.168.0.1 255.255.255.255 12.12.12.12
netsh interface ip set dns "Local Area Connection" static 192.168.0.2
netsh interface ip add dns "Local Area Connection" 192.168.0.3
netsh interface ip set winns "Local Area Connection" static 192.168.0.4

( fake adresses obvs)

any help or recomendations?
ask if you need more info!
DHCP not ideal for what I'm needing.
 
Solution
Google "create incremental IP addresses in Powershell"

Visit a few links and then refine your search as necessary.

You may be able to take some existing script and use it directly or modify for your requirements.

Example link:

https://powershell.org/forums/topic/script-to-assign-an-incrementing-list-of-ips-to-an-incrementing-list-of-servers/


Ralston18

Titan
Moderator
Google "create incremental IP addresses in Powershell"

Visit a few links and then refine your search as necessary.

You may be able to take some existing script and use it directly or modify for your requirements.

Example link:

https://powershell.org/forums/topic/script-to-assign-an-incrementing-list-of-ips-to-an-incrementing-list-of-servers/


 
Solution

mfeatherstone2

Prominent
Sep 21, 2017
2
0
510


Thanks i will look this up