Programatic Screen Sharing

You can remotely start ARD with kickstart, which I have previously covered at length. But Screen Sharing is a bit of a different little beast. To start up Screen Sharing, you can just use the following command:
echo -n enabled > /Library/Preferences/
I still prefer kickstart, but this method functions when you need something quick and easy. To then disable Screen Sharing, you can just toss the launchd item:
rm /Library/Preferences/
Once you have Screen Sharing started, you can then open the Screen Sharing application from a client by using the open command, followed by the protocol, which would be vnc and then the IP address. As with FTP you can also inject the user name and password into the open, following the //, by placing the user name followed by a colon (:) followed by the password and then the @ symbol (all before the IP address). For example, to connect to a computer with an IP address of using the username of krypted and the password of mypass you would use the following command.
open vnc://krypted:mypass@
You may encounter an encryption error, which if you are attempting to script can be annoying to click on. To suppress it, use defaults to set the dontWarnOnVNCEncryption key of the to True:
defaults write dontWarnOnVNCEncryption -bool TRUE
Have fun!

Mac OS X: VNC vs. VNC

The Sharing System Preference has Screen Sharing and Remote Management.  Both control VNC.  You can’t use one while using the other.  So what’s the difference.  Well, Screen Sharing, the new application in 10.5 doesn’t require that you purchase a copy of ARD if you only want to be able to control the screens of other Macs.  If you enable Screen Sharing then your Mac will show up in the SideBar of other systems in your environment.  Remote Management still works the same way it did in 10.4.