Here is a script which runs at shutdown to lower the startup sound volume. Works fine for me.
Create a stay-open AppleScript application, and make it background-only. Then add this app to your Login Items list so it starts at login and waits in the background until shutdown/restart to run. It obviously won't work if something causes it to quit before shutdown.
I called mine "Shutdown Actions", with script:
on quit
-- the following line sets internal speakers volume to 50% (to control startup sound volume)
do shell script "osascript -e 'set volume output volume 50'" password "password" with administrator privileges
continue quit
end quit
So it doesn't appear in your Dock while waiting to run, you can make the app background-only. I use a separate AppleScript droplet to modify it, with this script:
on openthe_file
tell application "System Events"
try
set posix_path to POSIX path of (item 1 of the_file) & "/Contents/Info.plist"
if not (existsproperty list item "LSUIElement" of property list fileposix_path) then
makenewproperty list itemat end of property list items of contents of property list fileposix_path ¬
with properties {kind:integer, name:"LSUIElement", value:0}
end if
set i to value of property list item "LSUIElement" of property list fileposix_path
set value of property list item "LSUIElement" of property list file posix_path to item (i + 1) of {1, 0}
activate
display dialog name of (item 1 of the_file) & " turned into " & item (i + 1) of {"background", "regular"} & ¬
" app." buttons {"OK"} default button "OK"
end try
end tell
end open