You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Get-WorkleapShareGate.ps1
# Define AppName
$AppName = "Sharegate Desktop"
# The ShareGate Migration Tool Download page (https://sharegate.com/download-migration-tool) uses JavaScript (assumed to to prevent the webpage being scraped),
# So we can not use the normal method, but thanks to CoPilot I have discovered ShareGate provide a php url (JSON file) with all the information we require:
$ReleaseUrl = "https://sharegate.com/app/themes/one-sharegate/editor/blocks/desktop-download/fetch-migration-tool.php"
$InstallInstructionsUrl = "https://documentation.sharegate.com/hc/en-us/articles/115000597267-Install-ShareGate-s-migration-tool"
Write-Verbose "Obtaining $($AppName) Release Versions from $($ReleaseUrl)...`n"
$Headers = @{
"accept" = "*/*"
"accept-language" = "en-GB,en;q=0.5"
"User-Agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0"
"Host" = "sharegate.com"
}
# Fetch the JSON content
$jsonContent = Invoke-RestMethod -Uri $ReleaseUrl -Headers $Headers
# Main script to fetch and process links
$AppVersions = @(
@{AppName = $($AppName); Type = 'msi'}
)
foreach ($AppVersion in $AppVersions) {
$SearchCount = 1 # This may need increasing as future versions are released
#Build each link with File Type specific versions
[version]$Version = Get-Version -String $($jsonContent.Version)
$URL = $($jsonContent.DownloadUrl)
#$URL = (Resolve-Uri -Uri $($jsonContent.DownloadUrl) -Headers $Headers).Uri
$ReleaseNotesUrl = $($jsonContent.DescriptionLink)
#$ReleaseNotesUrl = (Resolve-Uri -Uri $($jsonContent.DescriptionLink) -Headers $Headers).Uri
do {
if ($URL) {
New-NevergreenApp -Name $($AppVersion.AppName) -Version $($Version) -Uri $($URL) -Architecture 'multi' -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) (Version: $($Version)) release notes are available here: $($ReleaseNotesUrl)"
Write-Verbose "$($AppName) Install instructions are available here: $($InstallInstructionsUrl)"
The text was updated successfully, but these errors were encountered:
Script:
The text was updated successfully, but these errors were encountered: