$ErrorActionPreference = 'Stop' $root = '\\unas\Workspace\CDiag\Scripts\XHorse_MultiPROG_Ultimate_Kit\08_Collected_MultiPROG_Scripts' $githubDir = Join-Path $root 'GitHub' $targets = @( @{ Name = 'diachedelic_crc32.js'; Url = 'https://gist.githubusercontent.com/diachedelic/582ac8fab84b7f2c34ff358ac5cc7cfa/raw/crc32.js'; Sub = 'gist_diachedelic_crc32' }, @{ Name = 'bryc_checksum_algorithms.js'; Url = 'https://gist.githubusercontent.com/bryc/8a0885a4be58b6bbf0ec54c7758c0841/raw'; Sub = 'gist_bryc_checksums' } ) $results = @() foreach ($t in $targets) { $destDir = Join-Path $githubDir $t.Sub New-Item -ItemType Directory -Force -Path $destDir | Out-Null $dest = Join-Path $destDir $t.Name try { Invoke-WebRequest -Uri $t.Url -OutFile $dest -Headers @{ 'User-Agent' = 'Mozilla/5.0' } -TimeoutSec 30 $ok = $true $err = '' } catch { $ok = $false $err = $_.Exception.Message } $results += [pscustomobject]@{ Name = $t.Name; Url = $t.Url; Success = $ok; Error = $err } } $results | Format-Table -AutoSize -Wrap