Macro to renew DHCP lease?

Hi there,

Does anyone know a way to use KM to renew the DHCP lease?
Hope to hear from you. Thanks in advance,

with kind regards, Fleur

You could script control over the System Preferences, but I would start by googling for:

applescript renew DHCP lease

And seeing what scriptable solutions there are for doing this.

Have you tried this shell script as found here:

sudo ipconfig set en0 DHCP

Since it requires administrator privileges, for KM purposes I would wrap it with an AppleScript, like this:

do shell script "ipconfig set en0 DHCP" with administrator privileges

[test] DHCP.kmmacros (1.7 KB)

The script is targeting the en0 interface. You have to find out if this is correct in your case, or whether you rather have to use en1 (or another).

You find hints how to do that also on the above linked page, e.g.:

ipconfig getpacket en0

(try again with en1 etc.)

You have found the right interface when you get a non-empty response on the above command. I think.

1 Like