正如暗光所指出的,你不能使用 oauth 来下载文件......但你可以使用 jwt 和它有点简单......
#pre-reqs, PSZoom powershell module, an admin account on zoom, your oauth set and your JWT Auth set.
#update this to match your environment - you will need a JWT token, and they expire regularly,
#you will need your from and to dates, your download location,
#and to choose if you want auto delete (change no to yes AND uncomment the remove section on line 38
#autodelete is untested, be careful
import-module PSZoom
$Global:ZoomApiKey = 'YOUR API KEY'
$Global:ZoomApiSecret = 'YOUR API SECRET'
$base = "C:\working\Testing\"
$fromfile1 = "C:\working\zoomusers_$((Get-Date).ToString('MM-dd-yyyy')).csv"
$fromfile2 = "c:\working\rcdngs_$((Get-Date).ToString('MM-dd-yyyy')).csv"
$fromfile3 = "c:\working\DWNLD_$((Get-Date).ToString('MM-dd-yyyy')).csv"
$downlog = "c:\working\ZoomDownloads_$((Get-Date).ToString('MM-dd-yyyy')).log"
$deletelog = "c:\working\ZoomDelete_$((Get-Date).ToString('MM-dd-yyyy')).log"
$exportPath = 'c:\working\files\'
$Users = Import-Csv -Path $FromFile1
$MIDS = Import-Csv -Path $fromfile2
$Links = Import-Csv -Path $fromfile3
$jwt='YOUR VERY LONG JWT TOKEN'
$AToken='/?access_token='
$autodelete= 'NO'
Get-ZoomUsers -AllPages -status active | Where-Object {$_.type -eq "2"} |select id,first_name,last_name,email,pmi | export-csv $fromfile1 -NoTypeInformation
foreach ($user in $Users) {
Get-zoomRecordings -userId $user.email -From 2021-09-20 -PageSize 300 -To 2021-09-24 |select -ExpandProperty meetings| export-csv $fromfile2 -NoTypeInformation
foreach ($MID in $MIDS) {
Get-ZoomMeetingRecordings -MeetingId $MID.uuid | select -property topic,start_time -ExpandProperty recording_files| select -property topic,start_time,meeting_id,download_url| export-csv $fromfile3 -Append -NoTypeInformation}
}
foreach ($Link in $Links) {
$MTD = $Link.start_time.substring(0,10)
$path = ($base + $Link.topic)
If(!(test-path $path))
{
New-Item -ItemType Directory -Force -Path $path
}
$uri= ($link.download_url + $AToken + $jwt)
$inc = 1
$file=($path + "\" + $mtd + "-" + $inc + ".mp4")
If(!(test-path $file)) {
$wc=New-Object System.Net.WebClient
$wc.DownloadFile($uri,$file)
echo "downloading $file" | out-file $downlog -append}
else {
$inc=$inc+1
$file=($path + "\" + $mtd + "-" + $inc + ".mp4")
$wc=New-Object System.Net.WebClient
$wc.DownloadFile($uri,$file)
echo "downloading $file" | out-file $downlog -append}
if($autodelete -eq 'YES'){
#Remove-ZoomMeetingRecordings -MeetingId $link.meeting_id -Action delete
echo ($link.topic + " on " + $MTD + " was succesfully delted on $((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss'))") | out-file $deletelog -append
}
}