echo -n enabled > /Library/Preferences/com.apple.ScreenSharing.launchdI 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/com.apple.ScreenSharing.launchdOnce 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 192.168.200.2 using the username of krypted and the password of mypass you would use the following command.
open vnc://krypted:firstname.lastname@example.orgYou 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 com.apple.ScreenSharing.plist to True:
defaults write com.apple.ScreenSharing dontWarnOnVNCEncryption -bool TRUEHave fun!
krypted January 26th, 2010