I have physical access to a Mac Pro, but it has no monitor and I want to access it remotely. I don't know what state the Mac was left in (network connection, sharing prefs, etc). I am pretty sure I can open up a terminal window and execute a script without actually seeing what I am doing, just using the keyboard. Can someone help me with creating a script that will verify wifi is turned on, connect to a protected wifi network and enable remote management/login so I can VNC in?
Well since I didn't get any responses I did some googling and came up with the following:
To enable screen sharing I used
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all
To turn on airport I used
networksetup -setairportpower airport on
To connect to a specific network I used
networksetup -setairportnetwork en2 "$NETWORKNAME" $PASSWORD
It's worth noting that since the Mac Pro has two Ethernet ports, the Airport interface is en2, not en0 or en1.