Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $bootstrapperLocalPath = "\\domain.net\dfs$\Admin\SoftwareRepository\SWD\Microsoft\Teams\teamsbootstrapper.exe"
- $teamsInstallerLocalPath = "\\domain.net\dfs$\Admin\SoftwareRepository\SWD\Microsoft\Teams\MSTeams-x64.msix"
- $bootstrapperRemoteUrl = "https://go.microsoft.com/fwlink/?linkid=2243204"
- $teamsInstallerRemoteUrl = "https://go.microsoft.com/fwlink/?linkid=2196106"
- # Function to check if a file needs to be updated or downloaded if it doesn't exist
- function NeedsUpdateOrDownload($localPath, $remoteUrl) {
- if (-not (Test-Path $localPath)) {
- return $true
- }
- $localLastModified = (Get-Item $localPath).LastWriteTime
- $remoteLastModified = (Invoke-WebRequest -Uri $remoteUrl -Method Head).Headers.LastModified
- return $localLastModified -lt $remoteLastModified
- }
- # Check if bootstrapper needs update or download
- if (NeedsUpdateOrDownload $bootstrapperLocalPath $bootstrapperRemoteUrl) {
- Write-Host "Downloading latest Teams Bootstrapper..."
- Invoke-WebRequest -Uri $bootstrapperRemoteUrl -OutFile $bootstrapperLocalPath -UseBasicParsing -Verbose
- } else {
- Write-Host "Teams Bootstrapper is up to date."
- }
- # Check if Teams installer needs update or download
- if (NeedsUpdateOrDownload $teamsInstallerLocalPath $teamsInstallerRemoteUrl) {
- Write-Host "Downloading latest Microsoft Teams version..."
- Invoke-WebRequest -Uri $teamsInstallerRemoteUrl -OutFile $teamsInstallerLocalPath -UseBasicParsing -Verbose
- } else {
- Write-Host "Microsoft Teams installer is up to date."
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement