Skip to main content
Question

Script to change IP address by referencing the computer name.

  • September 6, 2013
  • 2 replies
  • 5 views

Forum|alt.badge.img+1

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

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • September 6, 2013

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?


Forum|alt.badge.img
  • New Contributor
  • April 1, 2014

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?