我正在尝试使用一个脚本来以静默模式安装 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"
}