networksetup

This command, along with its companion command systemsetup, provide a shell interface for interacting with various system settings. For a sys admin script writer, it can complement, but unfortunately not completely replace, the need to use AppleScript GUI scripting techniques that otherwise have to be used to automate the process of modifying a system's configuration.

To start using this command, you'll want to first open a Terminal window and go to the commands directory:

cd /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support

To find out what commands are supported by networksetup, do the following:

sudo ./networksetup -help


Below is a listing of all the commands provided by ARD 2.1:

networksetup Help Information
-------------------------------
Usage: networksetup -listnetworkserviceorder
Display services with corresponding port and device in order they are tried for connecting
to a network. An asterisk (*) denotes that a service is disabled.

Usage: networksetup -listallnetworkservices
Display list of services. An asterisk (*) denotes that a network service is disabled.

Usage: networksetup -listallhardwareports
Display list of hardware ports with corresponding device name and ethernet address.

Usage: networksetup -detectnewhardware
Detect new network hardware and create a default network service on the hardware.

Usage: networksetup -getmacaddress <hardwareport or device name>
Display ethernet (or AirPort) address for hardwareport or device specified.

Usage: networksetup -getcomputername
Display the computer name.

Usage: networksetup -setcomputername <name>
Set the computer's name (if valid) to <name>.

Usage: networksetup -getinfo <networkservice>
Display IPv4 address, IPv6 address, subnet mask,
router address, ethernet address for <networkservice>.

Usage: networksetup -setmanual <networkservice> <ip> <subnet> <router>
Set the <networkservice> TCP/IP configuration to manual with IP address set to ip,
Subnet Mask set to subnet, and Router address set to router.

Usage: networksetup -setdhcp <networkservice> [clientid]
Set the <networkservice> TCP/IP configuration to DHCP. You can set the
DHCP client id to the optional [clientid]. Specify "Empty" for [clientid]
to clear the DHCP client id.

Usage: networksetup -setbootp <networkservice>
Set the <networkservice> TCP/IP configuration to BOOTP.

Usage: networksetup -setmanualwithdhcprouter <networkservice> <ip>
Set the <networkservice> TCP/IP configuration to manual with DHCP router with IP address set
to ip.

Usage: networksetup -setv4off <networkservice>
Turn IPv4 off on <networkservice>.

Usage: networksetup -setv6off <networkservice>
Turn IPv6 off on <networkservice>.

Usage: networksetup -setv6automatic <networkservice>
Set the service to get its IPv6 info automatically.

Usage: networksetup -setv6manual <networkservice> <address> <prefixlength> <router>
Set the service to get its IPv6 info manually.
Specify <address> <prefixLength> and <router>.

Usage: networksetup -getdnsservers <networkservice>
Display DNS info for <networkservice>.

Usage: networksetup -setdnsservers <networkservice> <dns1> [dns2] [...]
Set the <networkservice> DNS servers to <dns1> [dns2] [...]. Any number of dns servers can be
specified. Specify "Empty" for <dns1> to clear all DSN entries.

Usage: networksetup -getsearchdomains <networkservice>
Display Domain Name info for <networkservice>.

Usage: networksetup -setsearchdomains <networkservice> <domain1> [domain2] [...]
Set the <networkservice> Domain Name servers to <domain1> [domain2] [...]. Any number of Domain Name
servers can be specified. Specify "Empty" for <domain1> to clear all Domain Name entries.

Usage: networksetup -create6to4service <newnetworkservicename>
Create a 6 to 4 service with name <newnetworkservicename>.

Usage: networksetup -set6to4automatic <networkservice>
Set the service to get its 6 to 4 info automatically.

Usage: networksetup -set6to4manual <networkservice> <relayaddress>
Set the service to get its 6 to 4 info manually.
Specify <relayaddress> for the relay address.

Usage: networksetup -getftpproxy <networkservice>
Display FTP proxy (server, port, enabled value) info for <networkservice>.

Usage: networksetup -setftpproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Set FTP proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.

Usage: networksetup -setftpproxystate <networkservice> <on off>
Set FTP proxy to either <on> or <off>.

Usage: networksetup -getwebproxy <networkservice>
Display Web proxy (server, port, enabled value) info for <networkservice>.

Usage: networksetup -setwebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Set Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.

Usage: networksetup -setwebproxystate <networkservice> <on off>
Set Web proxy to either <on> or <off>.

Usage: networksetup -getsecurewebproxy <networkservice>
Display Secure Web proxy (server, port, enabled value) info for <networkservice>.

Usage: networksetup -setsecurewebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Set Secure Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.

Usage: networksetup -setsecurewebproxystate <networkservice> <on off>
Set SecureWeb proxy to either <on> or <off>.

Usage: networksetup -getstreamingproxy <networkservice>
Display Streaming proxy (server, port, enabled value) info for <networkservice>.

Usage: networksetup -setstreamingproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Set Streaming proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.

Usage: networksetup -setstreamingproxystate <networkservice> <on off>
Set Streaming proxy to either <on> or <off>.

Usage: networksetup -getgopherproxy <networkservice>
Display Gopher proxy (server, port, enabled value) info for <networkservice>.

Usage: networksetup -setgopherproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Set Gopher proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.

Usage: networksetup -setgopherproxystate <networkservice> <on off>
Set Gopher proxy to either <on> or <off>.

Usage: networksetup -getsocksfirewallproxy <networkservice>
Display SOCKS Firewall proxy (server, port, enabled value) info for <networkservice>.

Usage: networksetup -setsocksfirewallproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Set SOCKS Firewall proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.

Usage: networksetup -setsocksfirewallproxystate <networkservice> <on off>
Set SOCKS Firewall proxy to either <on> or <off>.

Usage: networksetup -getproxybypassdomains <networkservice>
Display Bypass Domain Names for <networkservice>.

Usage: networksetup -setproxybypassdomains <networkservice> <domain1> [domain2] [...]
Set the Bypass Domain Name Servers for <networkservice> to <domain1> [domain2] [...]. Any number of
Domain Name servers can be specified. Specify "Empty" for <domain1> to clear all
Domain Name entries.

Usage: networksetup -getpassiveftp <networkservice>
Display whether Passive FTP is on or off for <networkservice>.

Usage: networksetup -setpassiveftp <networkservice> <on off>
Set Passive FTP to either <on> or <off>.

Usage: networksetup -getairportnetwork
Display current AirPort Network.

Usage: networksetup -setairportnework <network> [password]
Set AirPort Network to <network> using optional [password] if specified.

Usage: networksetup -getairportpower
Display whether AirPort power is on or off.

Usage: networksetup -setairportpower <on off>
Set AirPort power to either <on> or <off>.

Usage: networksetup -getnetworkserviceenabled <networkservice>
Display whether a service is on or off (enabled or disabled).

Usage: networksetup -setnetworkserviceenabled <networkservice> <on off>
Set <networkservice> to either <on> or <off> (enabled or disabled).

Usage: networksetup -createnetworkservice <newnetworkservicename> <hardwareport>
Create a service named <networkservice> on port <hardwareport>. The new service will be enabled by default.

Usage: networksetup -renamenetworkservice <networkservice> <newnetworkservicename>
Rename <networkservice> to <newnetworkservicename>.

Usage: networksetup -duplicatenetworkservice <networkservice> <newnetworkservicename>
Duplicate <networkservice> and name it with <newnetworkservicename>.

Usage: networksetup -removenetworkservice <networkservice>
Remove the service named <networkservice>. Will fail if this is the only service on the hardware port that <networkservice> is on.

Usage: networksetup -ordernetworkservices <service1> <service2> <service3> <...>
Order the services in order specified. Use "-listnetworkserviceorder" to view service order.

Usage: networksetup -getappletalk <networkservice>
Display whether AppleTalk is on or off (enabled or disabled) on <networkservice>.

Usage: networksetup -setappletalk <networkservice> <on off>
Set AppleTalk to either <on> or <off> (enabled or disabled) on <networkservice>.

Usage: networksetup -getMTU <hardwareport or device name>
Get the MTU value for hardwareport or device specified.

Usage: networksetup -setMTU <hardwareport or device name> <value>
Set MTU for hardwareport or device specified.

Usage: networksetup -listValidMTURange <hardwareport or device name>
List the valid MTU range for hardwareport or device specified.

Usage: networksetup -getMedia <hardwareport or device name>
Show both the current setting for media and the active media on hardwareport or device specified.

Usage: networksetup -setMedia <hardwareport or device name> <subtype> [option1] [option2] [...]
Set media for hardwareport or device specified to subtype. Specify optional [option1] and additional options depending on subtype. Any number of valid options can be specified.

Usage: networksetup -listValidMedia <hardwareport or device name>
List valid media options for hardwareport or device name. Enumerates available subtypes and options per subtype.

Usage: networksetup -version
Display version of networksetup tool.

Usage: networksetup -help
Display these help listings.

Usage: networksetup -printcommands
Displays a quick listing of commands (without explanations).


systemsetup >>