Articles‎ > ‎

Using Apple Remote Desktop send unix command - network setup & folder creation

posted Dec 23, 2008, 10:05 AM by Philip Rinehart   [ updated Dec 23, 2008, 10:05 AM by Greg Neagle ]
Written by Steve Hayman   
Tuesday, 07 December 2004

More Complex Scripts
cd /Users
for u in *; do
	mkdir $u/NewFolder
	chown $u $u/NewFolder
done

Create a new folder for every user. This loops through every user home folder in /Users (on every computer) and creates a new folder called "NewFolder"; note that this makes the (usually correct) assumption that all user home folders are in /Users, and that the home folder name matches the user name.

networksetup -listallnetworkservices | 
grep -v '*' |  
while read service; do
	networksetup -setwebproxy "$service" 10.1.2.3 8080
done

This script first uses "networksetup -listallnetworkservices" to produce a list of all network services (Built-in Ethernet, Airport, etc.) and then loops through each one, again using networksetup to set the web proxy for that service to 10.1.2.3, port 8080.

Comments