Microsoft Teams download script

athomson
New Contributor III

Hoping someone can help. Trying to write a script to download the latest version of Microsoft Teams for OS X. Using the following URL in Safari reveals the download location. However, using CURL does not. Anyone have any insight on how to retrieve the download path with CURL?

https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Try this. It seems to need to be surrounded in double quotes.

echo $(curl -s "https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64")

The above produces this for me:

https://statics.teams.microsoft.com/production-osx/1.0.00.14454/Teams_osx.dmg

I can then curl against that to get info on size and other details, or just download it

curl -sI https://statics.teams.microsoft.com/production-osx/1.0.00.14454/Teams_osx.dmg

Putting some of the above together with a few other items

#!/bin/sh

TeamsURL="https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64"

## Get the actual download URL
DownloadURL=$(curl -s "$TeamsURL")

## Extract the DMG Name from the path
DMGName="${DownloadURL##*/}"

## Download the DMG into /tmp/
curl -s "$DownloadURL" -o "/tmp/$DMGName"

I'll leave the rest to you to work out how to mount it and install it if that's what you were looking to do.

View solution in original post

3 REPLIES 3

mm2270
Legendary Contributor III

Try this. It seems to need to be surrounded in double quotes.

echo $(curl -s "https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64")

The above produces this for me:

https://statics.teams.microsoft.com/production-osx/1.0.00.14454/Teams_osx.dmg

I can then curl against that to get info on size and other details, or just download it

curl -sI https://statics.teams.microsoft.com/production-osx/1.0.00.14454/Teams_osx.dmg

Putting some of the above together with a few other items

#!/bin/sh

TeamsURL="https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64"

## Get the actual download URL
DownloadURL=$(curl -s "$TeamsURL")

## Extract the DMG Name from the path
DMGName="${DownloadURL##*/}"

## Download the DMG into /tmp/
curl -s "$DownloadURL" -o "/tmp/$DMGName"

I'll leave the rest to you to work out how to mount it and install it if that's what you were looking to do.

athomson
New Contributor III

Now I just feel stupid. Thanks.

milesleacy
Valued Contributor

Don't forget to check package and app signatures.