Manage Teams custom backgrounds using Intune

Update! I got some feedback on this blog. Seems that if your users are not members of the local administrator group, install will faill with error: 0x80070001. I've updated the article to solve this problem. I replaced the cmd files for Powershell scripts and did some minor changes to the detection and uninstall scripts. This should now work for users without admin permissions.

Microsoft introduced background effects in Teams. All of a sudden you see people having their custom backgrounds. You might wonder how this trick is done because there is no button to upload your own image (yet).

When you start using the default backgrounds during meetings, a folder is created in %AppData%\Microsoft\Teams called Backgrounds. Within that folder, you’ll find another folder called Uploads. When you drop an image into that folder, you can pick that image and use it as your custom background image during your Teams meeting.

For an avarage user, this is not convenient to do. You might want to do it for them. In this blogpost I’ll show you how to push a custom background image to your Windows 10 devices using Intune. I’ll use a Win32 application.


Update 04-06-2020: Teams now has an upload button, so it’s easier for users to upload their own images.

A warning up front. This might no be the best way to do this. This is just a way to do it.

What do we need?

  • A custom background image file
  • Few lines PowerShell to install the files
  • Powershell script for custom detection script (optional)
  • The Microsoft Win32 Content Prep Tool

Background image file

Pick a nice image (JPEG or PNG) that you want your users to use. In my demo, I use a free stock image with my “company logo”. The default images in Teams are 1920 x 1080 pixels, so I’ll stick to that. Optional, you can use https://tinypng.com/ to shrink them to a proper size. This is my source image:

Install and uninstall script

Next, we are going to create the install file for the Win32 app. Open up your favorite PowerShell editor and copy-paste the following code. Adjust the filename of the image to match yours.

#set upload folder
$UploadFolder="$env:APPDATA\Microsoft\Teams\Backgrounds\Uploads"

# create folder if not exists
if(!(Test-Path -path $UploadFolder))  
{  
 New-Item -ItemType directory -Path $UploadFolder
 Write-Host "Folder has been created successfully"
 }
else 
{ 
Write-Host "The folder already exists"; 
}

#copy all (image) files to the upload folder
Copy-Item -path '.\images' -Filter *.* -Destination $UploadFolder -Recurse -Container:$false

For the uninstall script, we simply use this line:

#set upload folder
$UploadFolder="$env:APPDATA\Microsoft\Teams\Backgrounds\Uploads"
#delete JPG
Remove-Item -Path $UploadFolder\*.jpg -Force

Note: the uninstall script will delete all JPG files from the upload folder. You can add specific files or filetypes to be deleted. 

Save both files as .ps1 files and put them into a folder on your local hard drive. Also, make an empty folder for your output file. Create a new folder ‘images’ and drop your background files in the folder. The script will copy all the files from that folder into the Teams upload folder.

The Microsoft Win32 Content Prep Tool

Grab the Microsoft Win32 Content Prep Tool from Github and start the tool. Enter the source folder, the setup file, and the output folder. When ready, you find the Intunewin file in the output folder. We need this file for our next step.

Detection script

I created a simple detection script. We need this in the next step. Create a .ps1 file with the follwing content:

if (Test-Path "$env:APPDATA\Microsoft\Teams\Backgrounds\Uploads\*.jpg") {
    Write-Host "File detected"
}
Note: if you use other extensions, make sure you replace the \*.jpg with your extension.

Win32 app

Next, we are going to create the Win32 app in Intune. Go to the Microsoft Endpoint Manager Admin Center and create a new Win32 app.

Select the app package file (intunewin)
Fill in the name, description and publisher
Fill in the install and uninstall command. Next, pick the user and restart behaviour

Install command: powershell.exe -executionpolicy Bypass .\install.ps1
Uninstall command: powershell.exe -executionpolicy Bypass .\uninstall.ps1
Select the requirements
Upload your custom powershell detection script that you created earlier
Add dependencies if needed. Otherwise click Next
Add scope tags if needed. Otherwise click Next
Pick the user or device group
Review your settings and click Create

Let’s see if it works!

Head over to your device. You’ll see the application being installed, and the custom image is created in the Teams appdata folder.

Uninstall

If you want your custom image deleted, just uninstall the Win32 application. Attach the group of devices in the uninstall section and make sure the mode is set to included.

Wrap things up

I guess Microsoft is releasing a better way for the Teams users to manage their own custom background images. For now this will do the trick. You can push a company managed image, and instruct your user to use it in meetings.

This is also an example of whats is possible using Win32 apps and files. Happy deploying!

Sources used:

M365 Environment 11 – Copy Files (Win32 App)

Working with (custom) detection rules for Win32 apps

Custom Background Images for Teams Meetings

36 thoughts on “Manage Teams custom backgrounds using Intune”

    1. Hi Dan, sure!

      You can either duplicate the copy line and replace the image filename:
      copy /Y .\CustomCompanyBackground1.jpg %UploadFolder%
      copy /Y .\CustomCompanyBackground2.jpg %UploadFolder%
      copy /Y .\CustomCompanyBackground3.jpg %UploadFolder%
      copy /Y .\CustomCompanyBackground4.jpg %UploadFolder%

      Or replace the line copy /Y .\CustomCompanyBackground.jpg %UploadFolder% by copy /Y .\*.jpg %UploadFolder%
      This will copy all image files (with .jpg extension in this case) to the Teams upload folder

  1. Jan, very cool! We followed each step exactly, and deployed to a 365 Group containing 26 users; 8 failed to install with 0x80070001 “unknown” errors. Any idea what I should be looking for in the client-side logs, or the Intune collect/download logs to figure out what it didn’t work for everyone?

      1. Hi, I have the same issue and can’t figure out why it wont work. I have two test clients, both running the 1909, not local admin and both are failing with this error. I can’t find anything in the logs that explains the issue – any ideas?

  2. Hi Jan,

    Thanks so much for this article.

    I am unable to see background folder under “%AppData%\Microsoft\Teams” folder, will it create during joining teams meeting or something missed here.
    If I want to use GPO for this setting , will it help.

      1. Hi Jan,

        Not sure but this is pushed through SCCM and it might be per machine base installation.
        To fix this can you please help me here.

  3. Hi Jan,

    One observation here when I joined teams meeting and click on “Show background effects” option there will show few background image and under “%AppData%\Microsoft\Teams” it will create background\upload folder as well but without click on “show background effects” how “background\upload” folder will show on end users machines.
    Is there any automation.

    Thanks in Advance for help me here.

    1. Hi Devendra, if the background folder itself is missing, I assume that your version needs to be updated. When you never used background images, the Upload folder is not shown, that’s what I saw too. My script is taking care of that. The background folder itself should already be there. What version do you use? This was my version the moment I was able to see backgrounds: 1.3.00.8663. Today, I’m on 1.3.00.12058

  4. Meshuggah Mischell

    Hi Folks is there a way to set my custom background as default ? I don’t want to choose the uploaded picture from the list everytime.
    Thank you in advance.

  5. Hi Jan,

    We also tried to deploy it this way and found out that alsmost all users had the “0x80070001″error. We found that all users with local admin rights had the backgrounds installed, all user without admin rights didn’t.

      1. Thanks Jan. I am using the updated article and I am getting the same errors as everyone else expressed. Can you share the details how it was fixed, perhaps I am missing something.
        Thanks for sharing such a nice article.

          1. Hi Carlos, I suggest you create a whole new Win32 app and follow the article from the start with the new scripts. Let me know of if you need any help after that.

  6. Now it works. Thanks. I use a variant of the powershell script to set the user’s deskop background to a corporate image.

  7. Pingback: Manage the video backgrounds of your users with Intune – 365 admin service

    1. Have not figured that out (yet) 😉 I’ve looked for this, but it seems not possible at the moment. As soon as I figure it out, I’ll update the post!

  8. Good morning

    I see that this setting does not block the image, in this case the user can still change.

    Is there a possibility of blocking?

Leave a Reply

Your email address will not be published. Required fields are marked *