Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New App Request] Xerox Print Awareness Client (On Proposals list) #101

Open
AScott-WWF opened this issue Jul 2, 2024 · 1 comment
Open

Comments

@AScott-WWF
Copy link

Script:

# Get-XeroxPrintAwarenessClient.ps1

# Define AppName
$AppName = "Xerox Print Awareness Client"

$ReleaseUrl = "https://www.support.xerox.com/en-us/product/xerox-print-awareness-tool/content/142452"

Write-Verbose "Obtaining $($AppName) Release Versions from $($ReleaseUrl)...`n"

# Main script to fetch and process links
$AppVersions = @(
    @{AppName = $($AppName); Architecture = 'multi'; Type = 'zip'; Pattern = '*.zip'}
)

foreach ($AppVersion in $AppVersions) {
    $SearchCount = 1 # This may need increasing as future versions are released

    #Build each link with File Type specific versions
    #URLs on this page are encoded, so need to decode to be readable
    $DownloadLink = (((Invoke-WebRequest -Uri $ReleaseUrl).Links) | Where-Object {($_.href -like $($AppVersion.Pattern))}).href
    $URL = [System.Net.WebUtility]::HtmlDecode($DownloadLink)
    $Version = Get-Version -String $URL
    
    do {
        if ($URL) {
            New-NevergreenApp -Name $($AppVersion.AppName) -Architecture $($AppVersion.Architecture) -Version $($Version) -Uri $($URL) -Type $($AppVersion.Type)
            break
        }

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

    if ($SearchCount -eq 0) {
        Write-Warning "Could not find release for $($AppName) $($AppVersion.Type)"
    }
}

@AScott-WWF
Copy link
Author

@DanGough Wondering if there might be some benefit in enhancing Nevergreen so any encoded URLs are automatically Decoded to a human readable URL as I had to do on this script

...
    #URLs on this page are encoded, so need to decode to be readable
    $DownloadLink = (((Invoke-WebRequest -Uri $ReleaseUrl).Links) | Where-Object {($_.href -like $($AppVersion.Pattern))}).href
    $URL = [System.Net.WebUtility]::HtmlDecode($DownloadLink)
...

This may mean a change needs to be made to the Uri logic on the New-NevergreenApp function 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant