Skip to content

Instantly share code, notes, and snippets.

@the-louie
Last active April 26, 2021 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-louie/ad35fa119827c315c0cc77ca7a3c45d9 to your computer and use it in GitHub Desktop.
Save the-louie/ad35fa119827c315c0cc77ca7a3c45d9 to your computer and use it in GitHub Desktop.
Copy random image and use as Teams background
<#
This script will pick a random jpeg from '$HOME\Pictures\teams-bg\' and copy it to the
Teams background image folder.
To make it work, save this script somewhere and then rename *any* jpeg-image to 'stdbg.jpg' and
use it as a custom background in teams. This file will be overwritten with the ranom background
image everytime the script executes.
Then create a new scheduled task to execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' with
the argument:
-command "PATH-TO-YOUR-SCRIPT\random-copy.ps1"
/// Louie 2021-04-23
#>
$FILENAME = Get-ChildItem "$HOME\Pictures\teams-bg\*.jpg" | resolve-path | get-random -count 1
Copy-Item $FILENAME -destination "$HOME\Appdata\Roaming\Microsoft\Teams\Backgrounds\Uploads\stdbg.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment