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
71 stars 16 forks source link

[New App Request] Google Workspace Sync for Microsoft Outlook #72

Open AScott-WWF opened 3 weeks ago

AScott-WWF commented 3 weeks ago

I have written a new NeverGreen script to return the latest versions of Google Worklspace Sync for Microsoft Outlook, this is obtained using a webscrape against their release notes page: https://support.google.com/a/answer/153463

N.B. The Uris have been obtained from both the Downloads page - for .Msi's (recommended for admin installs), and a direct link to the .exe file (recommended for user installs)

here is my script:

# Get-GoogleWorkspaceSync.ps1

$AppName = "Google Workspace Sync"

$Apps = @(
    @{Architecture = 'x64'; Type = 'Msi'; Pattern = 'Download 64-bit edition' } # Recommended for admins
    @{Architecture = 'x86'; Type = 'Msi'; Pattern = 'Download 32-bit edition' } # Recommended for admins
    @{Architecture = 'x86'; Type = 'Exe'; Pattern = 'Download GWSMO' } # Recommended for users
)

foreach ($App in $Apps) {
    try {
        $ReleaseURL = 'https://support.google.com/a/answer/153463'
        if ($App.Type -eq 'Exe'){
            $URL = 'https://dl.google.com/google-apps-sync/googleappssyncsetup.exe'
        } else {
            $DownloadURL = 'https://tools.google.com/dlpage/gssmo'
            $URL = Get-Link -Uri $DownloadURL -MatchProperty outerHTML -Pattern $App.Pattern
        }

        $Version = Get-Version -Uri $ReleaseURL -Pattern 'Release notes for (\d+\.\d+\.\d+\.\d+)'
        New-NevergreenApp -Name $AppName -Version $Version -Uri $URL -Architecture $App.Architecture -Type $App.Type
    }
    catch {
        Write-Error "$($MyInvocation.MyCommand): $($_.Exception.Message)"
    }
}