Hello All!
I've been banging my head against the keyboard on this one. I need to remove a specific Login Item from a user's Login Items IF they have it. I then need to add an updated version of that application into that user's Login Items (yes, login items... nothing else). In other words, I can't just blanket remove this application from startup items and then place the application into every user's login items. If the user had it in their login items, old one gets removed, new one gets placed in there.
I see people referencing:
osascript -e 'tell application "System Events" to delete login item "itemname"'
quite often, but this works for the currently logged in user. I need to be able to target this to specific, possibly non logged in users. I tried running a variant, something like:
su $user osascript -e 'tell application "System Events" to delete login item "itemname"'
but it simply wasn't executing as the user that had the login item. I'm looking specifically for a way to script this. I've been trying plist buddy but it just hasn't been working the way I expected.
Any help would be greatly appreciated. Please let me know if you need clarification - I know it's a bit confusing.
