Skip to content

Instantly share code, notes, and snippets.

@TristanvanOnselen
Created April 15, 2020 19:30
Show Gist options
  • Save TristanvanOnselen/2547739d52b0be55f596a402f4874814 to your computer and use it in GitHub Desktop.
Save TristanvanOnselen/2547739d52b0be55f596a402f4874814 to your computer and use it in GitHub Desktop.
<#
.NOTES
===========================================================================
Created with: PowerShell
Created on: 15-04-2020
Created by: Tristan van Onselen
Filename: Add-CustombackgroundsforTeams.ps1
===========================================================================
.DESCRIPTION
This script will add custom backgrounds for Teams
#>
$source = "https://sacomputeranalyzer.blob.core.windows.net/custombackgrounds/photo-1518481852452-9415b262eba4.zip"
Start-BitsTransfer -Source $source -Destination $env:temp
$filename = Split-Path -Path $source -Leaf
if(test-path -Path $env:temp\CustomBackgrounds)
{
remove-item $env:temp\CustomBackgrounds -Recurse -Force
}
Expand-Archive -LiteralPath $env:TEMP\$filename -DestinationPath "$env:temp\CustomBackgrounds" -Force
$AllLocalUsers = (Get-ChildItem -path $env:SystemDrive:\Users).name
$AllLocalUsers += "Default"
foreach($user in $AllLocalUsers)
{
$destination = ("$env:SystemDrive" + "\users\" + "$user" + "\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads")
if(!(Test-Path -Path $destination))
{
New-Item -Path "$destination" -ItemType Directory | out-null
}
copy-item -path "$env:temp\CustomBackgrounds\*.*" -Destination $destination -Force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment