Script to change IP address by referencing the computer name.

wmikolajczak
New Contributor

Has anyone ever written a script to change the IP address based on what the computer name is? I'd like to use something like this to change IPs on around 75 computers.

2 REPLIES 2

mm2270
Legendary Contributor III

Can you elaborate on the end goal here? How is the computer name relevant to its IP? Are you actually assigning IP addresses manually/statically on your Macs instead of using DHCP?

agwootton
New Contributor

Hi there, I'm not sure about OP however this is exactly what I would like to do.

I have an address range 172.29.40.* that has a specific rule in the firewall to allow specific ports that the Macs require

Currently I have to set these IP's manually after imaging and keep a spreadsheet of where each IP is assigned. I don't mind keeping the spreadsheet as this is always going to be necessary when bypassing DHCP but I would like to run a policy that checks the IP against the list and updates the IP address on the machine if it does not match.

Would this be possible?