Archive

Posts Tagged ‘Provisioning’

New-MtrWallpaper – Automatically Change Wallpaper on Teams Room System Every Day

January 19th, 2020 5 comments

Description

In playing with setting a custom wallpaper on some Microsoft Teams Room (MTR) systems, I wondered how hard it would be to have a new wallpaper everyday. I looked up the official documentation, as well as chatted with Eric Marsi (@EricMarsi) about how custom wallpaper is handled on MTRs. Eric has written an article, Configuring Custom Themes for Microsoft Teams/Skype Room Systems, on the basics of how to set a custom theme for an MTR, which includes a custom wallpaper. Check out his article. My article focuses on using the same core process, but automating it and having it run daily, randomly picking a new wallpaper each day.

My first theory was to just copy a wallpaper and generic SkypeSettings.xml file to the folder each day, then send a reboot command to the computer to implement the change. I had it all figured out, but then a coincidence made life easier. I was working at my PC on an unrelated project late one night (about 2:30am), when I heard the Rally camera behind me start it’s initialization process. When I checked, the Intel Nuc that serves as the compute for my Logitech Tap, was rebooting. I added “figure out what’s wrong with the Tap” to my task list. Anyways, next night, not having gotten that far down my task list yet, same thing happened, and I noticed it was at the exact same time. Time to roll up my sleeves. What I determined was there was a scheduled task called ‘NightlyReboot’ that runs at 2:00AM daily on MTRs. Drilling down, I discovered that a BUNCH of PowerShell scripts run as a result, including some that do Windows Updates, and some routine cleanup. At the end of this ~30 minute process was a Restart-Computer -Force command. I figured that makes life easier for my wallpaper idea. So, I came up with a function that looks into a folder full of wallpaper .jpg files, randomly selects one, and copies it to the appropriate folder. Next, the script writes a new XML file that includes ONLY the elements required for a custom theme. That’s all that’s done. I thought about just adding my function to one of these existing PowerShell scripts, but then opted not to do that to ensure it survives any upgrades and updates to the MTR software. The script is executed daily with a dedicated scheduled task. We then leverage the daily reboot that’s already in place to implement the changes. Presto – daily wallpaper change. I think I spent more time looking for cool wallpaper images than writing the code. One of my favorites is the Spy vs. Spy image shown above on one of the MTRs in my home office.

There is nothing fancy about my method, and it could easily be customized to use, say, an XML file full of dates and wallpaper names to use specific wallpaper images on certain days, such as holidays or company events and announcements.

Installation

Log onto the MTR as admin

Life is much easier if you use RDP to do all of this. RDP isn’t enabled by default on MTRs, but just enabling it Windows 10 is straight forward. Click ‘Settings’ on the touch screen, enter the password, then go to Windows settings. Enter the admin password and you’re in Windows 10. A quick search for ‘remote desktop’ gets you there. Everything configured here is done so while logged in as Admin.

Create folder

  • Open Windows Explorer and navigate to ‘C:\Users\Skype\AppData\Local\Packages\Microsoft.SkypeRoomSystem_8wekyb3d8bbwe\LocalState’. Create a folder there called ‘Wallpapers’.

Copy script to the Wallpapers folder.

  • Download the New-MtrWallpaper.ps1 script file from the link below, and copy it to the folder created above.

Upload wallpaper images

  • Copy all of your wallpaper files to that same folder. The script is written for .jpg files. You should now have a folder with the script and wallpapers in it.

Create scheduled task

Open Task Scheduler

  • Navigate to Task Scheduler Library>Microsoft>Skype
  • Create a new Basic Task called ‘Rotate Wallpaper’

On the ‘General’ tab:

  • Ensure that the admin account is specified under ‘When running the task, use the following user account’.
  • Select ‘Run whether user is logged on or not’
  • Select ‘Run with highest privileges’

On the ‘Triggers’ tab, create a trigger:

  • ‘Begin the task’ set to ‘On a schedule’
  • Set the ‘Settings’ to ‘Daily’
  • Set the time to any time before 2:00am. I use 10:15:00 PM. Set the recurrence to every 1 days (or whatever schedule you’d like, keeping in mind that the scheduled reboot only happens once a day).
  • All other check boxes except ‘Enabled’ should NOT be checked.

On the ‘Actions’ tab:

  • Set ‘Action’ to ‘Start a program’.
  • For Program/script, use ‘Powershell’.
  • For ‘Add arguments (optional)’, paste the following single line:

-NoProfile -ExecutionPolicy bypass -file C:\Users\Skype\AppData\Local\Packages\Microsoft.SkypeRoomSystem_8wekyb3d8bbwe\LocalState\Wallpapers\New-MtrWallpaper.ps1

  • For ‘Start in (optional), paste the following single line:

C:\Users\Skype\AppData\Local\Packages\Microsoft.SkypeRoomSystem_8wekyb3d8bbwe\LocalState\Wallpapers

On the ‘Conditions’ tab

  • Leave all blank except the first two under ‘Power’.

On the ‘Settings’ tab:

  • Select ‘Allow task to be run on demand’
  • Select ‘Stop the task if it runs longer than 1 hour’
  • Select ‘If the running task does not end when requested, force it to stop’.

Save the task, entering the password for the admin account when prompted. Now, right-click the task in the list, and select ‘Run’. Wait a few seconds and refresh, and the ‘Last Run Result’ field should say ‘The operation completed successfully. (0x0)’. Verify that both the SkypeSettings.xml and wallpaper.jpg now exist in the ‘C:\Users\Skype\AppData\Local\Packages\Microsoft.SkypeRoomSystem_8wekyb3d8bbwe\LocalState’ folder. Restart Windows. The MTR will boot accordingly, and you’ll have a new wallpaper. If you look into that folder now, the XML and wallpaper files will no longer be there.

Known Issues

There is a strange occurrence where I’ve manually run the script, then manually rebooted one of my MTRs and the new wallpaper wasn’t incorporated. However, every time the schedule task runs, and the MTR restarts as part of its nightly maintenance, it’s worked fine.

Frequently Asked Questions

Q. What resolution do my wallpaper files need to be?

A. They need to be exactly 3840×1080, regardless of whether you have a single or dual screen Teams Room System.

Q. How many wallpaper images can I have?

A. As many as you like, keeping in mind that the more you have, the less likely you’ll have consecutive days with the same image.

Q. Does this impact performance?

A. This script does NOT impact performance in any way. It can easily run while the MTR is connected to a meeting. The reboot occurs regardless, so no added impact there.

Download

This script is available in my GitHub repo at https://github.com/patrichard/New-MtrWallpaper. Feel free to grab it from there, and contribute any updates or improvements.

If you’re looking for wallpaper, Bing search yields a ton of them.

Changelog

See the changelog for information on what’s changed/included in each version.