Get-TeamsFolderStructure.ps1


Description

Purpose

Gets the folder structure for Microsoft Teams backgrounds.

Detailed Description

This function retrieves the folder structure for Microsoft Teams backgrounds. It determines whether the old or new folder structure is being used and returns the appropriate base path and upload path.

Back to Top

Usage

Example 1

PS C:\> Get-TeamsFolderStructure

Returns a hashtable with the folder structure for Microsoft Teams backgrounds.

Back to Top

Notes

Author: Unknown Last Edit: Unknown

Back to Top


Script

function Get-TeamsFolderStructure {
    <#
    .SYNOPSIS
        Gets the folder structure for Microsoft Teams backgrounds.
    
    .DESCRIPTION
        This function retrieves the folder structure for Microsoft Teams backgrounds. It determines whether the old or new folder structure is being used and returns the appropriate base path and upload path.
    
    .OUTPUTS
        Returns a hashtable with the following keys:
        - "Structure": Indicates whether the old or new folder structure is being used.
        - "BasePath": The base path for the Microsoft Teams backgrounds.
        - "UploadPath": The upload path for the Microsoft Teams backgrounds.
    
    .EXAMPLE
        PS C:\> Get-TeamsFolderStructure
        Returns a hashtable with the folder structure for Microsoft Teams backgrounds.
    
    .NOTES
        Author: Unknown
        Last Edit: Unknown
    #>
    $TeamsBackgroundBasePath = $env:APPDATA + "\Microsoft\Teams\Backgrounds\"
    $TeamsBackgroundUploadPath = $TeamsBackgroundBasePath + "Uploads\"

    $NewTeamsBackgroundBasePath = $env:LOCALAPPDATA + "\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Backgrounds\"
    $NewTeamsBackgroundUploadPath = $NewTeamsBackgroundBasePath + "Uploads\"

    $TeamsFolderStructure = @{
        "Structure"  = "Old";
        "BasePath"   = $TeamsBackgroundBasePath;
        "UploadPath" = $TeamsBackgroundUploadPath;
    }

    if (Test-Path $NewTeamsBackgroundUploadPath) {
        $TeamsFolderStructure["Structure"] = "New"
        $TeamsFolderStructure["BasePath"] = $NewTeamsBackgroundBasePath
        $TeamsFolderStructure["UploadPath"] = $NewTeamsBackgroundUploadPath
    }

    return $TeamsFolderStructure
}

Back to Top

Download

Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.


Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.

Issue


Back to Top