Rebuilding network interfaces

yurypanasyuk
New Contributor III

I am looking for a better method of rebuilding network interface. Is it possible to scan what devices are plugged in and re-add them? My script seems to go back to default. If a user, for instance, has a thunderbolt dock plugged in then it will be disconnected and will need to be manually added back in. =/

networksetup -detectnewhardware
networksetup -createlocation TempLocation populate && networksetup -switchtolocation TempLocation
networksetup -deletelocation Automatic
networksetup -createlocation Automatic populate && networksetup -switchtolocation Automatic
networksetup -deletelocation TempLocation
0 REPLIES 0