Set Default Screensaver

WillPrak
New Contributor II

Hey all, bit of a noob question but very new to the world of Casper Admin and scripting and need some expert advice.

One department I manage has created their own Screensaver which they would like deployed to their Mac's. I have packaged and successfully deployed the screensaver itself however I am stuck as to how to set it as the default screensaver. The screensaver is currently in: /Library/Screen Savers/custom.saver and it is showing as an option in the Screen Saver preference window which I can manually set but I would like to have it set as default without having to manually do it.

Any help would be greatly appreciated.

2 REPLIES 2

davidacland
Honored Contributor II

The setting is stored in a ByHost preference file in the users home folder. You can create a custom config profile with mcxToProfile that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>PayloadContent</key>
            <dict>
                <key>com.apple.screensaver.ByHost</key>
                <dict>
                    <key>Set-Once</key>
                    <array>
                        <dict>
                            <key>mcx_data_timestamp</key>
                            <date>2015-08-31T09:36:54Z</date>
                            <key>mcx_preference_settings</key>
                            <dict>
                                <key>CleanExit</key>
                                <string>YES</string>
                                <key>PrefsVersion</key>
                                <integer>100</integer>
                                <key>idleTime</key>
                                <integer>3600</integer>
                                <key>moduleDict</key>
                                <dict>
                                    <key>moduleName</key>
                                    <string>Flurry</string>
                                    <key>path</key>
                                    <string>/System/Library/Screen Savers/Flurry.saver</string>
                                    <key>type</key>
                                    <integer>0</integer>
                                </dict>
                            </dict>
                        </dict>
                    </array>
                </dict>
            </dict>
            <key>PayloadEnabled</key>
            <true/>
            <key>PayloadIdentifier</key>
            <string>MCXToProfile.bf8aab38-3404-4a85-8efe-858677b1c0f7.alacarte.customsettings.8dbf9eec-364d-4191-bb34-bd00f29e8c74</string>
            <key>PayloadType</key>
            <string>com.apple.ManagedClient.preferences</string>
            <key>PayloadUUID</key>
            <string>8dbf9eec-364d-4191-bb34-bd00f29e8c74</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
        </dict>
    </array>
    <key>PayloadDescription</key>
    <string>Included custom settings:
com.apple.screensaver.ByHost
</string>
    <key>PayloadDisplayName</key>
    <string>Default ScreenSaver: Flurry</string>
    <key>PayloadIdentifier</key>
    <string>ScreenSaver</string>
    <key>PayloadOrganization</key>
    <string></string>
    <key>PayloadRemovalDisallowed</key>
    <true/>
    <key>PayloadScope</key>
    <string>System</string>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>bf8aab38-3404-4a85-8efe-858677b1c0f7</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
</plist>

Save the file with the .mobileconfig extension and upload into the JSS.

Not applicable

I never used this from Casper, just ARD, but it should be easy enough to adapt:

# set /System/Library/Screen Savers/Flurry.saver
# tested OK on 10.9.5 - no need killall cprefsd etc

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`
fi

defaults write ~/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist moduleDict -dict path -string "/System/Library/Screen Savers/Flurry.saver" moduleName -string "Flurry"