cancel
Showing results for 
Search instead for 
Did you mean: 

Managing the desktop background and screensaver via JC cmd

shawnsong
Rising Star II
Rising Star II

Hi folks,

It's been a while since my last post, and what a fulfilling fortnight it has been for the quarter end! As usual, our customers brought a lot of great ideas to the table – managing desktop backgrounds and screensavers appears to be critical for many of them.

So, without further ado, let's address these asks on both macOS and Windows!

Please read on.

Windows

For Background

There is a Jumpcloud command template, you can find it here:

shawnsong_0-1680242103297.png

Detailed instructions are here alongside with the command script source code.

 

For Screensaver

  • Create a new command on JC admin console -> Windows -> Powershellshawnsong_1-1680242141763.png
    • Paste the lines below to the command body, and change line 14 “the file name” to your screensaver. 
      New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
      
      # Get all user SIDs from HKEY_USERS
      $sids = Get-ChildItem -Path 'HKU:' | Where-Object { $_.Name -match 'S-\d-\d+-(\d+-){1,14}\d+$' }
      
      # Iterate through each SID and set the properties for each user
      foreach ($sid in $sids) {
          $userRegPath = "HKU:\$($sid.Name.Replace('HKEY_USERS\', ''))\Control Panel\Desktop"
      
          Set-ItemProperty -Path $userRegPath -Name ScreenSaveActive -Value 1
          Set-ItemProperty -Path $userRegPath -Name ScreenSaverIsSecure -Value 1
          Set-ItemProperty -Path $userRegPath -Name ScreenSaveTimeOut -Value 120
          Set-ItemProperty -Path $userRegPath -Name SCRNSAVE.EXE -Value "C:\Windows\Temp\filename_of_your_scr"
      }
      ​
    • Scroll down a bit, upload the screensaver file: shawnsong_2-1680242183104.png
      • Save and bind to the target device(s) or device group, and give it a run!
      • (Optional) you can set to run this cmd repeatedly against a device group, in this case, every time a new device is added to that group, it will be automatically compiled. shawnsong_3-1680242206540.png

 

MacOS

It will be a similar approach for both operations: 

  1. Using a JC cmd to drop the wallpaper image / screensaver files into place. 
  2. Create a custom configuration profile to provide a path to the wallpaper image / screensaver. 
  3. Use a JC custom MDM configuration policy  to deliver and enforce the setting.

For Background

We can use the custom mobile config policy as instructed here

For Screensaver

  • Create a new command on JC admin console -> Mac -> Run as Root:shawnsong_4-1680242283294.png

     

  • Paste the line below to the command body, and change the file name to your screensaver. 
    mv /tmp/your_screen.saver.zip "/Library/Screen Savers/your_screen.saver"
  • Scroll down a bit, upload the screensaver file: shawnsong_5-1680242346859.png

     

  • Save and bind to the target device group.
  • Set to run this cmd repeatedly. This will make sure the screensaver file is there for the mobile.config to apply.                                                                         shawnsong_6-1680242374346.png

     

  • Now go to Policy Management -> add new -> “Mac - MDM Custom Configuration Profile Policy”: shawnsong_7-1680242404880.png
  • Upload the mobile.config as below, and change line 23 & 25 to reflect your screensaver’s file name:
    <?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>PayloadDisplayName</key>
               <string>Screensaver</string>
               <key>PayloadIdentifier</key>
               <string>com.apple.screensaver.AF6D0BF4-2403-447B-92D8-C046A3AD7FFE</string>
               <key>PayloadType</key>
               <string>com.apple.screensaver</string>
               <key>PayloadUUID</key>
               <string>836F1320-7FEC-40FC-96C7-53B87F9B41E6</string>
               <key>PayloadVersion</key>
               <integer>1</integer>
               <key>idleTime</key>
               <integer>10</integer>
               <key>loginWindowIdleTime</key>
               <integer>10</integer>
               <key>loginWindowModulePath</key>
               <string>/Library/Screen Savers/your_screen.saver</string>
               <key>moduleName</key>
               <string>your_screen_saver</string>
           </dict>
       </array>
       <key>PayloadDisplayName</key>
       <string>Set Screen Saver</string>
       <key>PayloadIdentifier</key>
       <string>JC-SG-Shawn.220282CE-7853-4251-BE0E-B6A872FB7308</string>
       <key>PayloadType</key>
       <string>Configuration</string>
       <key>PayloadUUID</key>
       <string>B77AB11A-0B7C-419F-86FB-9DFB05481917</string>
       <key>PayloadVersion</key>
       <integer>1</integer>
    </dict>
    </plist>
    
  • Save it and bind to the same device group as the cmd above. 

    Done!


    Happy Friday IT folks 🙂

 

10 REPLIES 10

BrightRodger
JumpCloud Employee
JumpCloud Employee

Much needed and well put together instructions @shawnsong!

JonathanGarzon
Novitiate I

Thank you very much for your information, do you know how we can change the background for Linux?

Hi Jonathan,

Glad you like it! Initially that was my plan to include Linux (Ubuntu desktop) into the post too, but tried all i can google it went no where 😣 and my Linux knowledge is fairly limited.  But i will definitely revisit this, if you find anything possibly has a chance, feel free to post it here, i'm happy to try it out too. 😉

Lakshmana
Novitiate I

Did the same for MAC Screen saver its not working 

 

could you share the screen shot of the cmd you setup for dropping the screenshot file, and if possible, the mobile config you use in the custom mobile config policy too?

paul-mb
Novitiate II

Hi Shawn, thanks for this script. My company recently refreshed their branding and the marketing team asked me to deploy a branded lock screen out to our Windows users. The script worked perfectly.

One thing to note, is that using the script means using the Personalization-CSP reg key. If this reg key is used, the end user will be prevented from changing their lockscreen or wallpaper. More info.

After a few protests from my users I had to roll these changes back!

Cheers,
Paul

Hi Paul,

 

Thanks for sharing your experience here in such an insightful way!

actually, if you wanted to mandate the background "soft-handed", you can tweak the cmd to NOT run on schedule, rather just shoot the cmd 1 time, and leave the space with the users to change the background/wallpaper later. 

Let me know if this is the scenario fits the need. 

 

 

Hey Shawn, 

Would you be able to elaborate? I would love to set a default wallpaper on Windows and Mac but still allow users to change them. 

you may just run the cmd once on both devices, then the user is able to make changes afterwards. however only the users with admin privileges will able to do that. 

nagaraju
Novitiate I

Windows its working but for mac tried same but not working

You Might Like

New to the site? Take a look at these additional resources:

Community created scripts:

Our new Radical Admin blog:

Keep up with Product News:

Read our community guidelines

Ready to join us? You can register here.