Forked from caseymullineaux/Download-Build2020.ps1
Created
November 20, 2020 18:19
-
-
Save PauloBoaventura/9e91bb6347c5a4dfbde231502a5146bf to your computer and use it in GitHub Desktop.
A simple script to download on-demand content from Microsoft Build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
# Verify the sessions file exists | |
[ValidateScript( { | |
if (-Not ($_ | Test-Path)) { | |
throw "File does not exist" | |
} | |
return $true | |
})] | |
[System.IO.FileInfo]$InputFile, | |
# Create a new directory if it does not exist | |
[ValidateScript( { | |
if (-Not ($_ | Test-Path)) { | |
New-Item -Type Directory $_ | |
} | |
return $true | |
})] | |
[System.IO.DirectoryInfo]$OutputDirectory | |
) | |
$codes = Get-Content $InputFile | |
$progress = 0 | |
ForEach ($_code in $codes) { | |
$progress += 1 | |
$percent = (($progress / $codes.count) * 100) | |
Write-Progress -Activity "Downloading Session: $_code" -Status "[$progress/$($codes.count)]" -PercentComplete $percent | |
if (-not (Test-Path $OutputDirectory\$_code.mp4)) { | |
Start-BitsTransfer -Source "https://medius.studios.ms/video/asset/HIGHMP4/B20-$_code" -Destination "$OutputDirectory\$_code.mp4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment