'How do I deploy a Script on SCCM - Error deploy
Please can help me on this one.
I have this script for clean the memory for teams by sccm
if execute the script on the PC with admin privilegies works, but went is send by sccm to a device show error.
and only close teams.
Write-Host "Stopping Teams Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Teams | Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Teams Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Teams Disk Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\cache" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\blob_storage" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\databases" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\cache" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\gpucache" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\Indexeddb" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\Local Storage" | Remove-Item -Recurse -Force -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"\Microsoft\teams\tmp" | Remove-Item -Recurse -Force -Confirm:$false
Write-Host "Teams Disk Cache Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Cleanup Complete... Launching Teams" -ForegroundColor Green
Start-Process -FilePath $env:LOCALAPPDATA\Microsoft\Teams\current\Teams.exe
Stop-Process -Id $PID
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
