Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. $bootstrapperLocalPath = "\\domain.net\dfs$\Admin\SoftwareRepository\SWD\Microsoft\Teams\teamsbootstrapper.exe"
  2. $teamsInstallerLocalPath = "\\domain.net\dfs$\Admin\SoftwareRepository\SWD\Microsoft\Teams\MSTeams-x64.msix"
  3.  
  4. $bootstrapperRemoteUrl = "https://go.microsoft.com/fwlink/?linkid=2243204"
  5. $teamsInstallerRemoteUrl = "https://go.microsoft.com/fwlink/?linkid=2196106"
  6.  
  7. # Function to check if a file needs to be updated or downloaded if it doesn't exist
  8. function NeedsUpdateOrDownload($localPath, $remoteUrl) {
  9. if (-not (Test-Path $localPath)) {
  10. return $true
  11. }
  12. $localLastModified = (Get-Item $localPath).LastWriteTime
  13. $remoteLastModified = (Invoke-WebRequest -Uri $remoteUrl -Method Head).Headers.LastModified
  14. return $localLastModified -lt $remoteLastModified
  15. }
  16.  
  17. # Check if bootstrapper needs update or download
  18. if (NeedsUpdateOrDownload $bootstrapperLocalPath $bootstrapperRemoteUrl) {
  19. Write-Host "Downloading latest Teams Bootstrapper..."
  20. Invoke-WebRequest -Uri $bootstrapperRemoteUrl -OutFile $bootstrapperLocalPath -UseBasicParsing -Verbose
  21. } else {
  22. Write-Host "Teams Bootstrapper is up to date."
  23. }
  24.  
  25. # Check if Teams installer needs update or download
  26. if (NeedsUpdateOrDownload $teamsInstallerLocalPath $teamsInstallerRemoteUrl) {
  27. Write-Host "Downloading latest Microsoft Teams version..."
  28. Invoke-WebRequest -Uri $teamsInstallerRemoteUrl -OutFile $teamsInstallerLocalPath -UseBasicParsing -Verbose
  29. } else {
  30. Write-Host "Microsoft Teams installer is up to date."
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement