Extraer los archivos de Adober Reader 11.0.6 con Powershell

Extraer los archivos de Adober Reader 11.0.6 con Powershell

Hola que tal amigos pues en esta ocasión vamos a ver con la ayuda de powershell como podemos hacer para extraer los archivos de Adobe Reader 11. lo primero que debemos hacer es descargar adobe reader (.exe) desde los archivos de ftp de la pagina oficial con el siguiente link.

untitled

ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.06/en_US/AdbeRdr11006_en_US.exe

ahora vamos a crear dos carpetas una que contenga el archivo descargado con el nombre de descarga preferentemente en C:\ y otra con el nombre de extracción quedando de la siguiente manera.

10

dentro de la carpeta descarga colocamos el .exe, ahora vamos a abrir un bloc de notas para copiar el siguiente código y lo guardamos como extracción.ps1 para posteriormente abrirlo con powershell.

aquí el código.

[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[string]$FileName,
[parameter(Mandatory=$true)]
[string]$DownloadFolder,
[parameter(Mandatory=$true)]
[string]$TargetFolder
)
Process {
    Write-Output «INFO: Extracting content to ‘$($DownloadFolder)\AdobeReader'»
    Start-Process -FilePath «$($DownloadFolder)\$($FileName)» -ArgumentList «-nos_o$($DownloadFolder)\AdobeReader -nos_ne» -Wait -NoNewWindow
    if (Get-ChildItem -Path «$($DownloadFolder)\AdobeReader» -Filter «AcroRead.msi») {
        Write-Output «INFO: Successfully extracted all files»
        Write-Output «INFO: Starting to create the AIP at ‘$($TargetFolder)'»
        Start-Process «msiexec.exe» -ArgumentList «/a $($DownloadFolder)\AdobeReader\AcroRead.msi /qn TARGETDIR=$($TargetFolder)» -Wait
        Write-Output «INFO: Successfully created the AIP»
        Write-Output «INFO: Searching for patches to apply»
        $Patches = Get-ChildItem -Path $DownloadFolder -Recurse -Filter «AdbeRdrUpd*.msp»
        $Patches | ForEach-Object {
            $PatchFilePath = $_ | Select-Object -ExpandProperty FullName
            if ($_ -match «AdbeRdrUpd») {
                Write-Output «INFO: Found: ‘$($_)'»
                Write-Output «INFO: Applying ‘$($_)'»
                Start-Process «msiexec.exe» -ArgumentList «/a $($TargetFolder)\AcroRead.msi /qb /p $($PatchFilePath) TARGETDIR=$($TargetFolder)» -Wait
                Write-Output «INFO: Succesfully applied ‘$($_)'»
                $SecurityPatches = Get-ChildItem -Path $DownloadFolder -Recurse -Filter «AdbeRdrSecUpd*.msp»
                $SecurityPatches | ForEach-Object {
                    $PatchFilePath = $_ | Select-Object -ExpandProperty FullName
                    if ($_ -match «AdbeRdrSecUpd») {
                        Write-Output «INFO: Found: ‘$($_)'»
                        Write-Output «INFO: Applying ‘$($_)'»
                        Start-Process «msiexec.exe» -ArgumentList «/a $($TargetFolder)\AcroRead.msi /qb /p $($PatchFilePath) TARGETDIR=$($TargetFolder)» -Wait
                        Write-Output «INFO: Succesfully applied ‘$($_)'»
                    }            
                }
            }
            else {
                Write-Output «INFO: Unable to locate any patches»
            }
        }
        Write-Output «Successfully created a slipstreamed installer for Adobe Reader»      
    }
    else {
        Write-Output «ERROR: Unable to loate AcroRead.msi after extraction»
    }
    Copy-Item «$($DownloadFolder)\AdobeReader\setup.ini» -Destination «$($TargetFolder)» -Force
    Remove-Item «$($DownloadFolder)\AdobeReader» -Recurse -Force
}
11
ahora abrimos powershell con privilegios elevados y ejecutamos el siguiente código.
.\extraccion.ps1 -FileName «AdbeRdr11006_en_US.exe» -DownloadFolder «C:\descarga» -TargetFolder «C:\extraccion»
12
el resultado.
13
14
felices despliegues 🙂

MAP L.I. Jesús Octavio Rodríguez de Santiago

https://www.facebook.com/freelance.deployment
http://www.freelance-it.com.mx
@freelanceitags

Tabla de contenidos

Categorías

Categorías