Skript, Adobe Reader kontroll ja silent install

From ICO wiki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Skript, Adobe Reader kontroll ja silent install

<# 
.SYNOPSIS 
    Powershell script Adobe Reader X installiks. silent mode.
.DESCRIPTION 
    See skript töötab Adobe MSI installeriga ning ei ole garanteeritud et uuemad installerid töötavad tõrgeteta.
.NOTES 
    Additional Notes, eg 
    File Name  : Kodu1.ps1 
    Author     : Viljar Rooda - vrooda@itcollege.ee 
    Requires   : PowerShell V2 CTP3 
    Appears in -full  
.EXAMPLE 
         .\kodu.ps1 C:\Users\home\Desktop\AdbeRdr1000_en_US.msi
         Msi fail on pärit ftp://ftp.adobe.com/pub/adobe/reader/win/10.x/10.0.0/en_US/AdbeRdr1000_en_US.msi
         Kui Adobe reader pole installitud siis paigaltatakse see.
         Kui adobe reader on juba installitud siis ütleb adobe versooni. 
.PARAMETER File 
   see parameeter leiab skripti jaoks vajaliku msi faili.
.PARAMETER silent
    See parameeter on selleks kui versiooni muutuse tõttu on muutunud default silent string valeks saab sisestada uue stringi.
#>  

Param(

    [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
    [string]$File,
    [Parameter(Position=1, ValueFromPipeline=$true)]
    [string]$silent="/qn /norestart REBOOT=ReallySuppress DISABLE_3D=YES DISABLE_MULTIMEDIA=YES EULA_ACCEPT=YES SUPPRESS_APP_LAUNCH=YES DEFAULT_VERB=Read"
 )

$colItems = get-wmiobject -class "Win32_Product" -namespace "root\CIMV2" `


Function Install{
$path = ("MSIEXEC /I"+" " + $File +" "+ $silent)
Invoke-Expression $path | out-null
if($LASTEXITCODE -eq 0) { "success" }

}


$adobe = $colItems | where {$_.Name.Contains("Adobe Reader")}
if(!$adobe ) 
{
   Install
}
else
{
   write-host "Installed alredy" $adobe.Name
}