Browse the docs

Switch network location

Switches to a named network location, such as Automatic or Office.

Switch network location to name

Keyboard Maestro: SetNetworkLocation

Details #

Switches the Mac to the network location called name, the same as choosing it from the Location menu in the Network settings. Locations hold sets of network settings, so this changes your network setup in one go.

The name must match a location that exists. The step has no output.

Parameters #

ParameterTypeRequiredValuesWhat it does
locationtextAnother spelling of name.
nametextThe location's name, like Automatic. Required.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

This really switches your network location, and Automatic is the standard one:

Switch to the Automatic network location (really switches)
Do
  1. Switch the network location to “Automatic”
  2. Show “Network location: Automatic”
Open in Switchboard to try it

Gotchas #

  • The step runs the networksetup tool. If it fails, the step fails with "couldn't switch to the network location …" and the tool's own message, for example when no location has that name.

  • In a dry run the step is simulated.

See also #

Network, Run shell script