I’m working on a script that is needed to modify another user’s loginwindow.plist for administrative reasons. Unfortunately, i’m unable to figure out how to run applescripts as an administrator, or to do individual commands inside of an applescript as an administrator. I know i could use something silly like:
do shell script "osascript -e 'bunch of lines here'" with administrator privileges
but it seems to me that there must be an easier way than writing an applescript to call a shell script that runs an applescript!
here’s the example i need to accomplish with admin access:
tell application "System Events"
set plist to (newhome & "Library/Preferences/loginwindow.plist")
set props to value of property list item "AutoLaunchedApplicationDictionary" of property list file plist
copy {|Path|:"/Library/Management/keychain.command", |Hide|:true} to end of props
set value of property list item "AutoLaunchedApplicationDictionary" of property list file plist to props
end tell