0

I am trying to have a script that will install exe and msi files in silent mode, but it's opening the installers instead of running silently.

#network drive path
$nwDrivePath = "\\server\folder\"                                                  #"

#check if path is valid
if (test-path $nwDrivePath){
    Set-Location $nwDrivePath
}
else{
    #if path is not valid abort
    Write-Output "No path found for $nwDrivePath"
    Write-Output "Aborting script"
    break script
}

#install .exe files
    $allFiles = Get-ChildItem $nwDrivePath -Filter *.exe | ForEach {
    Start-Process $_.Fullname -ArgumentList "/s"
    }

#install .msi files
    $allFiles = Get-ChildItem $nwDrivePath -Filter *.msi | ForEach {
    Start-Process $_.Fullname -ArgumentList "/qn"
    }

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • It's not working how? Any errors? – Abraham Zinala Jun 28 '21 at 23:45
  • No error, just opens a installer, not silent. – Alex Ivanov Jun 28 '21 at 23:49
  • 2
    The correct syntax to silently install an msi package is `msiexec.exe /i ...\msi-file.msi /qn`. You may read more about here: [msiexec Install Options](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/msiexec) – Olaf Jun 29 '21 at 00:29
  • Thank you @Olaf can you help me put this in to this code? – Alex Ivanov Jun 29 '21 at 00:45
  • If your .exe doesn't support silent installation then there is no option. But you can always do a silent installation using .msi files. – Dilly B Jun 29 '21 at 05:18
  • @AlexIvanov This might get you started: [https://stackoverflow.com/q/51448642/9196560](https://stackoverflow.com/q/51448642/9196560) – Olaf Jun 29 '21 at 06:54

0 Answers0