Last active
August 29, 2015 14:03
-
-
Save rchaganti/ece986ad9cb5b5e9241d to your computer and use it in GitHub Desktop.
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
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