disable self service from launching at reboot

tranatisoc
New Contributor II

hi all -

we have a self service (SS) policy that users click, does some action and restart immediately...this policy works fine. except after user logs back in, self service auto relaunch.

this may be a feature by design (not sure)....but is there an option to prevent SS relaunch after the reboot?

6 REPLIES 6

mm2270
Legendary Contributor III

The reason that happens is because the reboot is happening in a non graceful manner, i.e. apps are not being quit normally before the reboot, so the OS is relaunching any apps that were open when it force restarted the Mac. The OS stores these open apps in the users ByHost com.apple.loginwindow plist file in an array called "TALAppsToRelaunchAtLogin"

I don't know if there's a preferred Apple-y method to stop this, but in the past I would have a script delete the contents of that TALAppsToRelaunchAtLogin array at the completion of the policy before the reboot. Upon login, no apps would auto relaunch. Keep in mind it's more than just Self Service that will auto launch after login when this happens. If they have other apps open at the time, they will open up again too.
As far as my testing back at the time was concerned, removing that array had no effect on apps they specified should be launched at login, like ones added to the Login Items tab under their account. Those are stored elsewhere.

tranatisoc
New Contributor II

hi mm2270 - thanks for the quick reply.

please could you assist me with the command or script to delete the contents of that TALAppsToRelaunchAtLogin array?

strider_knh
Contributor II

The default options in macOS is to re-open any application that was open when you logged out, this includes Self Service.

If the user has un-checked that box during logout then even Self Service should not re-open.

The fix that mm2270 list would also work.

tranatisoc
New Contributor II

actually strider.knh, even when user unchecked/unselect that relogin settings, SS would still always relaunch.

looking forward to mm2270 method to delete this array

mm2270
Legendary Contributor III

Sure, here is what I found in one of my scripts. I have not used this in a while now, so I can't say if it still works as is under Sierra for example. I would think it should still work, but give it a try and see.

#!/bin/sh

## Get the logged in user
loggedInUser=$(stat -f%Su /dev/console)

## Get the Mac's UUID string
UUID=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformUUID/{print $4}')

## Delete the plist array
/usr/libexec/PlistBuddy -c 'Delete :TALAppsToRelaunchAtLogin' /Users/${loggedInUser}/Library/Preferences/ByHost/com.apple.loginwindow.${UUID}.plist

tranatisoc
New Contributor II

hi mm2270, it's working with sierra.

many thanks for your assistance!

all the best!