Public/Get-Cyberduck.ps1
Function Get-Cyberduck { <# .SYNOPSIS Get the current version and download URIs for Cyberduck for Windows. .NOTES Site: https://stealthpuppy.com Author: Aaron Parker Twitter: @stealthpuppy .LINK https://github.com/aaronparker/Evergreen .EXAMPLE Get-Cyberduck Description: Get the current version and download URIs for Cyberduck for Windows - Stable, Beta and Nightly. #> [OutputType([System.Management.Automation.PSObject])] [CmdletBinding()] Param() # Get application resource strings from its manifest $res = Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1] Write-Verbose -Message $res.Name # Walk through each update URI (Stable, Beta and Nightly) ForEach ($release in $res.Get.Update.Uri.GetEnumerator()) { # Query the update feed $params = @{ Uri = $res.Get.Update.Uri[$release.key] ContentType = $res.Get.Update.ContentType } $Content = Invoke-RestMethodWrapper @params # Convert the update feed to an XML object If ($Null -ne $Content) { # Capture the URL without https:// & replace // with / # Then put the URL back together try { $path = [RegEx]::Match($Content.enclosure.url, $res.Get.Update.MatchUrlPath).Groups[0].Value $url = "https://$($path -replace "//", "/")" } catch { $url = $Content.enclosure.url } # Output the object $PSObject = [PSCustomObject] @{ Version = "$($Content.enclosure.shortVersionString).$($Content.enclosure.version)" Date = ConvertTo-DateTime -DateTime $Content.pubDate -Pattern $res.Get.Update.DatePattern Channel = $release.Name URI = $url } Write-Output -InputObject $PSObject } } } |