powershell - 通过网络部署和安装 MSI
问题描述
下午好,我写了以下内容以将 msi 从网络位置复制到临时目录,然后静默安装。MSI 文件为 1.5gb。已经 30 分钟了,它仍在复制到单个主机名,甚至还没有开始安装部分。有没有更有效的方式来部署这个 MSI?理想情况下,我想将它部署到网络上的许多主机名,但如果它对一个主机名来说这么慢 - 它将无法使用。谢谢
$computername = Get-Content "\\server\List.txt"
$sourcefile = "\\server\package.msi"
#This section will install the software
foreach ($computer in $computername)
{
$destinationFolder = "\\$computer\C$\temp"
#This section will copy the $sourcefile to the $destinationfolder. If the Folder does not exist it will create it.
if (!(Test-Path -path $destinationFolder))
{
New-Item $destinationFolder -Type Directory
}
Copy-Item -Path $sourcefile -Destination $destinationFolder
Invoke-Command -ComputerName $computer -ScriptBlock { & cmd /c "msiexec.exe /i c:\temp\package.msi" TRANSFORMS=Package.mst /q LICENSEKEY="xxx" LICENSEKEYCAPENSYS="xxx" LICENSETO="Company Name" DEFAULTPDFAPP=1 CENTRALCONFIG="C:\Installer\temp 4" CENTRALCONFIGAUTOUPDATE=1 ADDLOCAL=Core,DMContextMenu,OfficeAddins,OutlookAddin,PD3App,ShellIntegration,OCRDESKTOP,Capensys,IEPreview,ShellPreview
}
}
解决方案
推荐阅读
- android - UnityPlayerActivity 不加载纸板
- python - 递归到 NLTK 脚本的迭代变换
- lda - Adam' 对象没有属性 'zero_grads'
- c# - 在 MVC 中,在 POST 期间,如何遍历模型状态中的模型对象列表?
- c - 用户退出时如何关闭控制台窗口?
- c++ - 有什么东西可以阻止 std::optional::value_or() 有条件地为 noexcept 吗?
- python - 在我的基于数组的列表实现中为 append 方法编写单元测试
- python - PyQt 使用适当的抗锯齿调整 QMovie 的大小
- node.js - 无法从 fetch 中获取所有响应数据
- javascript - 试图在 Node 环境中使用 babel JavaScript 或 TypeScript 文件