Created
April 29, 2020 00:11
-
-
Save DeploymentMX/ab1e9965af400de323b0af6050750ba1 to your computer and use it in GitHub Desktop.
This file contains 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
set-executionpolicy bypass | |
if (Test-Path "$($Env:Appdata)\Microsoft\Teams\Backgrounds\Uploads") { | |
#Remove-Item -path "$($Env:Appdata)\Microsoft\Teams\Backgrounds\Uploads\*.*" | |
New-item -path C:\temp –type directory | |
.\azcopy copy 'https://deploymentmx.blob.core.windows.net/token/azcopy.exe' 'C:\temp\' | |
.\azcopy copy 'https://deploymentmx.blob.core.windows.net/token/background.jpg' 'C:\temp\' | |
$route = 'C:\temp\' | |
copy-item $route\background.jpg "$($Env:Appdata)\Microsoft\Teams\Backgrounds\Uploads\" | |
write-host "End of Script" | |
Remove-Item -path "C:\temp\azcopy.exe" | |
Remove-Item -path "C:\temp\background.jpg" | |
Remove-Item -path "C:\temp" | |
exit | |
} | |
else | |
{ | |
$Excluded_Profiles = @( 'Default User', 'All Users', 'Default', 'Public' ) | |
$Profiles = Get-ChildItem 'c:\users\' -Directory -force | Where-Object { $_.BaseName -notin $excluded_profiles } | |
$targetFolder = "\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads" | |
foreach ($ProfilePath in $Profiles.FullName) { | |
$Destination = Join-Path -Path $ProfilePath -ChildPath $TargetFolder | |
try { | |
if (-not (Test-Path $Destination -ErrorAction Stop)) { | |
New-Item -Path $Destination -Itemtype Directory -ErrorAction Stop | |
New-item -path C:\temp –type directory | |
.\azcopy copy 'https://deploymentmx.blob.core.windows.net/token/azcopy.exe' 'C:\temp\' | |
.\azcopy copy 'https://deploymentmx.blob.core.windows.net/token/background.jpg' 'C:\temp\' | |
$route = 'C:\temp\' | |
copy-item $route\background.jpg "$($Env:Appdata)\Microsoft\Teams\Backgrounds\Uploads\" | |
write-host "End of Script" | |
Remove-Item -path "C:\temp\azcopy.exe" | |
Remove-Item -path "C:\temp\background.jpg" | |
Remove-Item -path "C:\temp" | |
} | |
Copy-Item -Path $pictures -Destination $Destination -Force -ErrorAction Stop | |
} catch {} | |
} | |
} | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment