设想:
我有一个用于部署的 GPO软件ABC.msi每台符合 GPO 的计算机都将安装 SoftwareABC。
现在我有一个 Service Pack软件ABC_SP1.msi,部署了新的 GPO,并且它也部署了。
问题:
配置新 PC 时,有时会与尝试在所有者应用程序之前安装 ServicePack 发生冲突。
解决方案:
有什么办法可以避免这种行为吗?
答案1
您可以创建一个 PowerShell 脚本来执行部署,而不是部署软件包,该脚本将由 GPO 触发,检查是否有正在进行的安装,以及服务包是否已安装。
# Main application MSI file
$mainApplicationMSI = "SoftwareABC.msi"
# Service pack MSI file
$servicePackMSI = "SoftwareABC_SP1.msi"
# Check if the main application is installed
function IsMainApplicationInstalled {
$mainAppInstalled = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq $mainApplicationMSI }
return [bool]$mainAppInstalled
}
# Check if the main application is installed
if (IsMainApplicationInstalled) {
Write-Host "Main application is already installed. Proceeding with service pack installation."
# Install the service pack
Start-Process -FilePath msiexec.exe -ArgumentList "/i `"$servicePackMSI`" /qn" -Wait
} else {
Write-Host "Main application is not installed. Please install the main application first."
}