Public/Functions/split/Get-GithubRawContent.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
function Get-GithubRawContent { [CmdletBinding()] param ( [Parameter(Mandatory)] [System.Uri] # Github Url to retrieve $Uri ) $GithubRawUrl = Get-GithubRawUrl -Uri $Uri #Write-Verbose $GithubRawUrl if ($GithubRawUrl) { foreach ($Item in $GithubRawUrl) { Write-Verbose $Item try { $WebRequest = Invoke-WebRequest -Uri $Item -UseBasicParsing -Method Head -ErrorAction SilentlyContinue if ($WebRequest.StatusCode -eq 200) { Invoke-RestMethod -Uri $Item } } catch { Write-Warning $_ } } } } |