Created
June 4, 2020 01:35
-
-
Save PSingletary/8b726a98df128fba3989bb4f2b11aef3 to your computer and use it in GitHub Desktop.
Delete Microsoft Teams Cache for All Users Script - Source : https://www.reddit.com/r/PowerShell/comments/gvts0f/delete_microsoft_teams_cache_for_all_users_script/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Define RegEx filter to match folder names | |
| $FoldersToRemove = “(cache|storage|database|blob|IndexedDB|tmp)” | |
| #Get folders within Teams AppData area | |
| $Folders = Get-ChildItem “C:\Users\$($_.Name)\AppData\Roaming\Microsoft\Teams” | |
| #Switch statement checks the folder names and removes if found to match what is in $FoldersToRemove | |
| switch -RegEx ($Folders.Name) { | |
| $FoldersToRemove {Remove-Item $_.FullName -Recurse -Force} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or
$usersList = Get-ChildItem ‘HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList’ | % {Get-ItemProperty $ .pspath } | ? {$.profileImagePath -like 'C:\users*'} | Select *
$folderArray = @(‘folder1’,’folder2’)
$usersList | % {
$user_item = $_
#Code here to deal with user profiles found
$user_item
}