从网络文件夹静默安装 msi 和 exe

时间:2021-06-28 23:42:31

标签: powershell installation windows-installer exe silent

我正在尝试使用一个脚本来以静默模式安装 exe 和 msi 文件,但它会打开安装程序而不是静默运行。

#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"
    }

0 个答案:

没有答案