简体   繁体   中英

Powershell install software sequentially

please can you help me? I made this script for silent software install on new formatted PC. Why this will install Chrome only? Which is the correct way to start msiexec.exe in powershell? Thanks a lot in advance.

$7zip = Get-ChildItem -Path . -Name "7z*"
$vlc = Get-ChildItem -Path . -Name "vlc*"
$firefox = Get-ChildItem -Path . -Name "fire*"
$pdf24 = Get-ChildItem -Path . -Name "pdf24*"
$chrome = Get-ChildItem -Path . -Name "googlechrome*"

msiexec.exe /i "$zip" /L*V C:\MyLog.log /q ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1
msiexec.exe /i "$vlc" /L*V C:\MyLog.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1
msiexec.exe /i "$firefox" /L*V C:\MyLog.log /q ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1
msiexec.exe /i "$pdf24" /L*V C:\MyLog.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1
msiexec.exe /i "$chrome" /L*V C:\MyLog.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1
.\AcroRdrDC1900820071_it_IT.exe /sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YES

Here's the problem solved! After many attempts, I made it.

#remove space from filename
Get-ChildItem -Path . -file | Rename-Item -NewName {$_.Name -replace ' ', ''}
#getting filename of setup files
$7zip = Get-ChildItem -Path . -Name "7z*"
$vlc = Get-ChildItem -Path . -Name "vlc*"
$firefox = Get-ChildItem -Path . -Name "fire*"
$pdf24 = Get-ChildItem -Path . -Name "pdf24*"
$chrome = Get-ChildItem -Path . -Name "googlechrome*"
$adobe = Get-ChildItem -Path . -Name "acro*"

#start msiexec to install files


Start-Process "msiexec.exe" -ArgumentList "/i $7zip /L*V C:\MyLog-7z.log /q ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1" -Wait -NoNewWindow 

Start-Process "msiexec.exe" -ArgumentList "/i $vlc /L*V C:\MyLog-vlc.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1" -Wait -NoNewWindow

Start-Process "msiexec.exe" -ArgumentList "/i $firefox /L*V C:\MyLog-vlc.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1" -Wait -NoNewWindow

Start-Process "msiexec.exe" -ArgumentList "/i $pdf24 /L*V C:\MyLog-pdf.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1" -Wait -NoNewWindow

Start-Process "msiexec.exe" -ArgumentList "/i $chrome /L*V C:\MyLog-chrome.log /qn ADDLOCAL=ALL REBOOT=ReallySuppress ALLUSERS=1" -Wait -NoNewWindow

Start-Process ".\$adobe" -ArgumentList "/sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YES" -Wait -NoNewWindow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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