简体   繁体   English

下载最新的Adobe Reader DC Update的脚本

[英]Script to download latest Adobe Reader DC Update

I wrote a script download the latest version of Adobe MUI DC but I am not really happy with the parsing. 我写了一个脚本来下载最新版本的Adobe MUI DC,但是我对解析并不满意。 The script starts at https://supportdownloads.adobe.com/new.jsp , followed by some parsing, getting a link to a new site, parsing and finally getting the final download link. 该脚本始于https://supportdownloads.adobe.com/new.jsp ,然后进行一些解析,获取到新站点的链接,进行解析并最终获得最终的下载链接。

I am not really sure if this is the best way of doing it? 我不确定这是否是最好的方法吗?

$webclient = New-Object System.Net.WebClient

$download_folder = 'E:\Adobe_Acrobat_Reader_DC_MUI\'
$url = 'https://supportdownloads.adobe.com/support/downloads/'

    Write-Host "Downloading ...AdobeDC Update"
    try {
        If(!(Test-Path $download_folder)){
            New-Item -ItemType Directory -Force -Path "$download_folder"
        }

        $download_url = $url + ((Invoke-WebRequest $url'new.jsp').Links | where outertext -like '*MUI*Continuous*' | select href).href
        Write-Host $download_url

        $download_url = $url + ((Invoke-WebRequest $download_url).Links | where outertext -like '*proceed to download*' | select outertext, href).href.replace("amp;","")
        Write-Host $download_url

        $download_url = ((Invoke-WebRequest $download_url).Links | where outertext -like '*download now*' | select outertext, href).href 
        Write-Host $download_url

        if(!(Test-Path ($download_folder + $download_url.Split('/')[-1]))){
            $webclient.DownloadFile($download_url, $download_folder + $download_url.Split('/')[-1])
        }
    } catch {
        Throw($_.Exception)
    }

Adobe have an Enterprise Administration Guide that is intended for businesses deploying software to multiple machines (rather than the end user themselves updating their own computer). Adobe具有企业管理指南 ,该指南旨在供企业将软件部署到多台计算机上(而不是最终用户自己更新自己的计算机)。

For Acrobat DC there is a section for Enterprise installers: 对于Acrobat DC,有一个适用于企业安装程序的部分:

Adobe provides enterprise IT with a download site that contains all available installers. Adobe为企业IT提供了一个包含所有可用安装程序的下载站点。 Most admins download the product, updates, and patches from ftp://ftp.adobe.com/pub/adobe/reader/ (or Acrobat). 大多数管理员从ftp://ftp.adobe.com/pub/adobe/reader/ (或Acrobat)下载产品,更新和补丁。

That FTP link is a much easier way to get the latest version than scraping multiple websites. 与抓取多个网站相比,该FTP链接是获取最新版本更容易的方法。

You would just need to open the ftp site ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/ , get the directory listing, pick the latest folder, and then download the *MUI installer. 您只需要打开ftp站点ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/ ,获取目录列表,选择最新文件夹,然后下载*MUI安装程序。

So currently you would be downloading: 因此,当前您将要下载:

ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/1801120036/AcroRdrDCUpd1801120036_MUI.msp

This technique can be used for pretty much any Adobe product as they are all available: ftp://ftp.adobe.com/pub/adobe/ 该技术几乎可以用于所有Adobe产品,因为它们都可用: ftp : //ftp.adobe.com/pub/adobe/


Out of curiosity on this I wrote a basic script to get the latest file from the ftp site: 出于好奇,我编写了一个基本脚本来从ftp站点获取最新文件:

$DownloadFolder = "E:\Adobe_Acrobat_Reader_DC_MUI\"
$FTPFolderUrl = "ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/"

#connect to ftp, and get directory listing
$FTPRequest = [System.Net.FtpWebRequest]::Create("$FTPFolderUrl") 
$FTPRequest.Method = [System.Net.WebRequestMethods+Ftp]::ListDirectory
$FTPResponse = $FTPRequest.GetResponse()
$ResponseStream = $FTPResponse.GetResponseStream()
$FTPReader = New-Object System.IO.Streamreader -ArgumentList $ResponseStream
$DirList = $FTPReader.ReadToEnd()

#from Directory Listing get last entry in list, but skip one to avoid the 'misc' dir
$LatestUpdate = $DirList -split '[\r\n]' | Where {$_} | Select -Last 1 -Skip 1

#build file name
$LatestFile = "AcroRdrDCUpd" + $LatestUpdate + "_MUI.msp"

#build download url for latest file
$DownloadURL = "$FTPFolderUrl$LatestUpdate/$LatestFile"

#download file
(New-Object System.Net.WebClient).DownloadFile($DownloadURL, "$DownloadFolder$LatestFile")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM