首页 > 解决方案 > 通过网络部署和安装 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
 }
}

标签: powershellwindows-installersilent

解决方案


推荐阅读