Skip to content

Instantly share code, notes, and snippets.

@rchaganti
Last active August 29, 2015 14:03
Show Gist options
  • Save rchaganti/ece986ad9cb5b5e9241d to your computer and use it in GitHub Desktop.
Save rchaganti/ece986ad9cb5b5e9241d to your computer and use it in GitHub Desktop.
Function Test-Url {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[String] $Url,
[Parameter()]
[Switch] $ReturnUri
)
Process {
if ([system.uri]::IsWellFormedUriString($Url,[System.UriKind]::Absolute)) {
$true
} else {
$false
}
}
}
$Msi = @()
$doc = Invoke-WebRequest -Uri 'https://github.com/Azure/azure-powershell/releases'
foreach ($href in ($doc.links.href -ne '')) {
if ((Test-Url -Url $href) -and $href.EndsWith('.msi')) {
$Msi += New-Object -TypeName PSObject -Property @{
"Url" = $href
"Version" = ([Regex]::Match($href,'\bv?[0-9]+\.[0-9]+\.[0-9]+(?:\.[0-9]+)?\b')).Value
}
}
}
$Msi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment