DanGough / Nevergreen

This module is an alternative to Evergreen, and allows you to find the latest version and download URL for various Windows apps. Evergreen uses API queries to obtain its data whereas this module is more focussed on web scraping. This is more prone to breaking when websites are changed, hence the name.
The Unlicense
77 stars 18 forks source link

[New App Request] Devolutions Remote Desktop Manager (on Proposals list) #80

Open AScott-WWF opened 4 months ago

AScott-WWF commented 4 months ago

Script:

# Get-DevolutionsRemoteDesktopManager.ps1

# Define AppName
$AppName = "Devolutions Remote Desktop Manager"

$AppVersions = @(
    @{Type = 'exe'; Pattern = 'rdmsetup/'}
    @{Type = 'zip'; Pattern = 'rdmbin/'}
    @{Type = 'msi'; Pattern = 'rdmmsi/'}
)
# Main script to fetch and process links
$ReleaseUrl = "https://devolutions.net/remote-desktop-manager/home/download/"
$ReleaseNotesUrl = "https://devolutions.net/remote-desktop-manager/release-notes/"
$InstallInstructionsUrl = "https://docs.devolutions.net/rdm/installation/client/"

Write-Verbose "Obtaining $($AppName) Release Versions from $($ReleaseUrl)...`n"
foreach ($AppVersion in $AppVersions) {
    $SearchCount = 1 # This may need increasing as future versions are released

    $DLURL = Set-UriPrefix -Uri (Get-Link -Uri "$($ReleaseUrl)" -MatchProperty href -Pattern $($AppVersion.Pattern)) -Prefix 'https://devolutions.net'
    $URL = Get-Link -Uri $($DLURL) -MatchProperty OuterHTML -Pattern 'click here'
    [version]$Version = Get-Version -String $URL
    do {
        if ($URL) {
            New-NevergreenApp -Name $AppName -Version $Version -Uri $URL -Architecture 'x64' -Type $AppVersion.Type
            break
        }

        $SearchCount--
    } until ($SearchCount -eq 0)

    if ($SearchCount -eq 0) {
        Write-Warning "Could not find release for $($AppName) $($AppVersion.Type)"
    }
}
Write-Verbose "$($AppName) Release notes are available here: $($ReleaseNotesUrl)"
Write-Verbose "$($AppName) Install instructions are available here: $($InstallInstructionsUrl)"