How to set up a screen saver without any user login? Just on the login screen.

New Contributor III

i have set ScreenSave for current with script , but all user logout the screensave become the system screensave's not satisfy our customers' requirements.

this shell just set screensave when user login ,when not login the screensave is also show system screensave.

please help me ! Advance thanks.

if [ ! -d "/Library/Screen Savers/Default Collections/OPPO/" ];then
    echo "ERROR: Directory does not exists. Exiting"
    exit 1
    #delete old ScreenSave images
    lines=`find  /Library/Screen Savers/Default Collections/OPPO -mtime +1 | wc -l`
    for (( i = 0; i < $lines; i++ )); do
        find  /Library/Screen Savers/Default Collections/OPPO -mtime +1 | tail -n 1 | sed 's/ /\ /g' | xargs rm -rf

    currentUser=`ls -l /dev/console | cut -d " " -f 4`

    # grab the system's uuid
    if [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` != "00000000-0000-1000-8000-" ]]; then
        macUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62`

    #jamf displayMessage -message $currentUser

    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist CleanExit "YES"
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist PrefsVersion -int 100
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist idleTime -int 600
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist moduleDict -dict moduleName "iLifeSlideshows" path "/System/Library/Frameworks/ScreenSaver.framework/Resources/iLifeSlideshows.saver" type -int 0
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist tokenRemovalAction -int 0
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist LastViewedPhotoPath ""
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist SelectedFolderPath "/Library/Screen Savers/Default Collections/OPPO"
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist SelectedSource -int 3
    defaults write /Users/$currentUser/Library/Preferences/ByHost/$macUUID styleKey "KenBurns"

    chown $currentUser /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist
    chown $currentUser /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist
    chmod 700 /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist
    chmod 700 /Users/$currentUser/Library/Preferences/ByHost/$macUUID.plist

    killall cfprefsd

Valued Contributor