Forum Discussion
Backgrounds
Has anybody worked out how to add custom backgrounds programmatically? We will need to push our corp imagery to make it available for all staff. Previously this was done by GPO putting images into %APPDATA%\Microsoft\Teams\Backgrounds. The new location seems to be %LOCALAPPDATA%\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Backgrounds\Uploads - however manual copy of images to this location, even if you include the image and thumb from the old location don't work. When using the GUI to add images, they are put into the uploads folder with a randomised name and auto generated thumb. I also tried copying these to a different users machine same location but it doesn't recognise them, so they must be indexed somehow elsewhere?
29 Replies
- PaulA10Copper ContributorI have made a simple Powershell script with a GUI to take any image file, rename it to the new naming standard (GUID), create and resize a _thumb file, and then move them both to a specified location.
I then distribute these using GPO. Hope it helps someone.
https://github.com/M11Y4G1/Teams-Rename - tdalonCopper ContributorI have implemented a solution for a user to import backgrounds files to his client (the best we can do now with poor encrypted naming)
It is available in a small AutoHotkey-based PowerTool. See https://tdalon.blogspot.com/2023/10/teams-import-background.html- tdalonCopper ContributorThis is a bit offside but I have also implemented in the Teams PowerTool a convenient way to switch backgrounds also by real name. See https://tdalon.blogspot.com/2023/11/teams-set-background.html with a short demo screencast https://youtu.be/DnUr3bpC7nw
- The_SchaefCopper ContributorWhile the background feature is nominally functional, the guid naming convention is a real pain. Old Teams didn't have this constraint, and I can't fathom a good reason that it would be necessary.
- mattssmith2003Copper Contributor
aaronm443 have you found the location for MacBooks ? Thanks in advance 🙂
- jiskaCopper ContributorA lot of much better scripters than I on this thread. It seems there are bits and pieces of code everywhere. Did anyone come up with a total script that deploys images to all computers from a central repository?
- ITGuy337Brass Contributor
Here we go again Micro$oft. If your products weren't half-baked garbage I wouldn't mind paying. Don't forget people, $2.5 TRILLION dollars, that's apparently what they are worth.
Ah well, I'm off to play Candy Crash Saga, while watching NetFlix, "backing up" my cherished memories to OneDrive and clicking the click-bait on the default Edge page, in my "Professional" Windows environment.- jiskaCopper ContributorZoom was always the better product for meetings, but most people used Teams because it was part of their O365 subscription. If we're going to have to start paying these sorts of fees, may as well flick over to Zoom which has much better features anyway, such as breakout rooms.
We're looking at AUD$15,000 a year to license 120 users for Teams Premium. And we're a Microsoft Partner. No chance in hell we're paying that just to customise a few backgrounds. Most of the other features in Teams Premium are pretty useless. To be honest, if they had a $1 per month license to implement customised backgrounds, we'd probably just pay it. - Steve_PrenticeIron Contributor
ITGuy337 Need a beer? 🙂
- ITGuy337Brass ContributorA few weeks later and, yes I still do.
- brzayasCopper Contributor
I've created a powershell script to convert a directory of image files to png, create both an original and thumbnail image with the correct guid and filename. I was then able to see the files in the new teams.
# Install the necessary .NET namespace Add-Type -AssemblyName System.Drawing # Import the necessary .NET namespace Add-Type -AssemblyName System.Drawing # Dummy function to satisfy the GetThumbnailImage method function dummyCallback { return $false } # Define the folder containing the image files $sourceFolder = "C:\Path\To\Source\Images" # Define the folder to save the converted images $destinationFolder = "C:\Path\To\Destination" # Loop through each image file in the source folder Get-ChildItem -Path $sourceFolder -File | ForEach-Object { # Generate a GUID for the new image name $guid = [guid]::NewGuid().ToString() # Create a .NET Bitmap object from the image file $originalImage = [System.Drawing.Image]::FromFile($_.FullName) # Save the image as a PNG with a GUID-based name $originalImage.Save("$destinationFolder\$guid.png", [System.Drawing.Imaging.ImageFormat]::Png) # Create a thumbnail image $thumbWidth = 278 $thumbHeight = 159 $thumbnailImage = $originalImage.GetThumbnailImage($thumbWidth, $thumbHeight, [System.Drawing.Image+GetThumbnailImageAbort]$dummyCallback, [System.IntPtr]::Zero) # Save the thumbnail image as a PNG with a GUID-based name and "_thumb" suffix $thumbnailImage.Save("$destinationFolder\$guid`_thumb.png", [System.Drawing.Imaging.ImageFormat]::Png) # Dispose of the image objects to free resources $originalImage.Dispose() $thumbnailImage.Dispose() }
- Steve_PrenticeIron ContributorI love this, well done and thanks.
I'm trying to get my head around how I could store images centrally and get clients to check on a scheduled bases for newly added images... for now this script is great as a run once, but the random GUIDs mean it can't be run multiple times. I guess the only way around that is some sort of local log file that the script updates/checks against which has the original image name and the GUID that was produced, and if either doesn't exist then carry on, otherwise skip.
Anyone else any better ideas?- brzayasCopper Contributor
Steve_Prentice So I'm not hosting these images in an Azure blob. What I implemented in my environment was deploying this as an Intune Win32 App and using PowerShell scripts to Install, Uninstall and Detect the correct files are placed in both the Old Teams Background directory and the New Teams. Since our org are still on a mix of both app variants. As far as wanting to update images, what you can do is when their are new images you can just create a new Intune App with the new photos whenever you have new images to upload. The GUID is a unique identifier so different images won't have the same GUID.
If anyone would like to go that route, below is what I setup.
- I have a directory with the install/uninstall/detection Scripts and a folder called bg that contains all the background images, you can place as many as you want.
- Using the IntuneWinAppUtil.exe I package all the files for creating the app on Intune
- When creating the app I used these Install/Uninstall commands
- Install:
%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\install.ps1
- Uninstall:
%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\uninstall.ps1
- Install:
Below are the scripts for this app:
install.ps1
$PackageName = "Teams-Backgrounds" $Version = "1" $Path_4Log = "$ENV:LOCALAPPDATA\_MEM" Start-Transcript -Path "$Path_4Log\Log\$PackageName-install.log" -Force $ErrorActionPreference = "Stop" try{ # Local folder $TeamsBG_Folder = "$env:APPDATA\Microsoft\Teams\Backgrounds\Uploads" $TeamsBG_Folder_New = "$env:LOCALAPPDATA\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Backgrounds\Uploads" # Ensure the folder is present New-Item -ItemType directory -Path $TeamsBG_Folder -Force # Copy backgrounds New-Item -ItemType directory -Path $TeamsBG_Folder_New -Force Copy-Item -path ".\bg\*" -Destination $TeamsBG_Folder_New -Recurse -Force Copy-Item -path '.\bg\*' -Destination $TeamsBG_Folder -Recurse -Force # Validation File New-Item -Path "$Path_4Log\Validation\$PackageName" -ItemType "file" -Value $Version -Force }catch{ Write-Host "_____________________________________________________________________" Write-Host "ERROR" Write-Host "$_" Write-Host "_____________________________________________________________________" } Stop-Transcript
uninstall.ps1
$PackageName = "Teams-Backgrounds" $Path_4Log = "$ENV:LOCALAPPDATA\_MEM" Start-Transcript -Path "$Path_4Log\Log\$PackageName-uninstall.log" -Force $TeamsBG_Folder = "$env:APPDATA\Microsoft\Teams\Backgrounds\Uploads" $TeamsBG_Folder_New = "$env:LOCALAPPDATA\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Backgrounds\Uploads" $TeamsBG_Files = Get-ChildItem -Path '.\bg' -Name # Delete distributed backgrounds Get-ChildItem $TeamsBG_Folder_New | Where{$_.Name -in $TeamsBG_Files} | Remove-Item Get-ChildItem $TeamsBG_Folder | Where{$_.Name -in $TeamsBG_Files} | Remove-Item # Delete detection file Remove-Item -Path "$Path_4Log\Validation\$PackageName" -Force Stop-Transcript
check.ps1
$PackageName = "Teams-Backgrounds" $Version = "1" $Path_4Log = "$ENV:LOCALAPPDATA\_MEM" $ProgramVersion_current = Get-Content -Path "$Path_4Log\Validation\$PackageName" if($ProgramVersion_current -eq $Version){ Write-Host "Found it!" }
I hope this helps anyone looking for an alternative way to deploy teams backgrounds.
- I have a directory with the install/uninstall/detection Scripts and a folder called bg that contains all the background images, you can place as many as you want.
- yamautomateCopper Contributor
aaronm443
Just worked on this. Yes, custom Backrgounds can be deployed here:
%localappdata%\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Backgrounds\UploadsMake sure you follow the notation of Backgrounds you add manually. Seems the new Teams client renames the files to "a GUID.jpeg". If you follow that notation, your backgrounds appear in the new Teams.
I copied the filename of a BG I added manually and incremented a number. Seems to work so far. I can definitely see MSFT pay-walling this though.
- aaronm443Copper Contributor
yamautomate thank you for looking into this. I can't replicate your success with just <guid>.jpeg, however I found that manually adding/creating a <guid>_thumb.jpeg with a maximum width of 280px seems to have worked!
- yamautomateCopper Contributor
aaronm443
Yes you also need to have a Thumbnail for each background picture. That Thumbnail needs to match the GUID of the background picture:- 0b19f8d7-66d7-8856-ba5a-aaa04a3d309d.jpeg
- 0b19f8d7-66d7-8856-ba5a-aaa04a3d309d_thumb.jpeg
In my approach, I use an Azure Blob to store the pictures with their Thumbail (I add them manually to "classic" Teams beforehand, grab them from the "Uploads" Folder and upload them to the Blob).
Then my PowerShell Script (distributed via Intune) downloads all Files from that Blob. If NewTeamsIsPresent on the System where the Script runs, it downloads the same file as for "classic" Teams but creates a GUID from the Filename.
As I was quite happy that you found the needed Path for the "New" Teams Client, I'll happily share my working Script with you. May it be helpful for some1 out there:
https://github.com/yamautomate/Set-TeamsCustomBackgrounds
- mohaa98Brass ContributorAny update or solution on this?
We also have been deploying custom backgrounds via win32 app in Intune. So far we've only enabled the new Teams version for IT dept to test out but would definitely be an issue for us if there is no way to deploy these without having to buy the premium license.. - David SchragIron Contributor
aaronm443 Any update on this? I think it was rotten enough to take away the ability to push custom backgrounds through the Teams admin console, but at least with "old" Teams the IT department could work around this by using other file distribution methods. I just upgraded to New Teams last week and I'm having the same experience as you did a month ago, with randomized file names in a hard-to-find location path.
- aaronm443Copper ContributorI haven't spent any more time on this as yet. After testing, the new Teams is so far from feature complete/parity with the old Team we can't consider it for enterprise deployment in the near future. Our testers have mostly reverted to old teams, which seems to still be getting feature updates (via the Public and Developer preview channels) that the new teams is not (eg the greenscreen background is only in old Teams, and was just released to preview)! It's an odd situation.
- MatthiasRodlerIron Contributorhttps://learn.microsoft.com/en-us/microsoftteams/custom-meeting-backgrounds
- aaronm443Copper ContributorI hope that is not restricted to the Premium SKU. That would be a kick in the teeth to take functionality away only to sell it back for an additional cost.
- Steve_PrenticeIron ContributorAgree. I don't mind Premium licencing for a GUI central management feature (that we won't use), that's fine.... but don't stop us manually deploying backdrops into the right places if we wish. 😕 I spent quite a lot of time with ProcMon the other day trying to work out if it updates a file or the registry with details of manually installed backgrounds but couldn't figure out what it does.