set startup disk

Hi everone,

I need to setup the startup disk using applescript code only without using the unix bless command. The code below doesn’t work.


set bootvol to “Macintosh HD”
tell application “System Events”
set disk item “bootVol” to boot volume
end tell

Your help is appreciated.

Tommy

Hi,

you cannot set the startup volume with System Events. Use the shell command systemsetup (available in 10.5 or higher)


set myStartupVolume to "bootVol"
do shell script "/usr/sbin/systemsetup -setstartupdisk '/Volumes/" & myStartupVolme & "/System/Library/CoreServices'" password "¢¢¢¢¢" with administrator privileges

Thank you Stefan for your continuos help.

Tommy