powershell - 微软office 16补丁安装
问题描述
$source1 = "https://www.microsoft.com/en-us/download/details.aspx?id=36805" #KB267083## $destination1 = "C:\Users\cdac\Desktop\Shravan\shravan_data_backup\PowerShell_Scripts\Windows_7_Automation_Scripts\KB2670838.exe" ### KB2670838 ###
Invoke-WebRequest -Uri $source1 -OutFile $destination1
[Hashtable[]]$Installers = @();
$Installers += @{
SoftwareName = "KB2670838"
Url = "https://www.microsoft.com/en-us/download/details.aspx?id=36805"
Destination = "C:\Users\cdac\Desktop\Shravan\shravan_data_backup\PowerShell_Scripts\Windows_7_Automation_Scripts\KB2670838.exe"
Arguments = '/s'
InstalledPath = 'C:\Program Files\KB2670838.exe'
}
function Install-Software([Hashtable]$installer)
{
Write-Host "Installing $($installer.SoftwareName)"
Write-Host "Invoke-WebRequest -Uri $($installer.Url) -OutFile $($installer.Destination)"
Write-Host "Start-Process -FilePath $($installer.Destination) -ArgumentList $($installer.Arguments) -Wait"
Invoke-WebRequest -Uri $installer.Url -OutFile $installer.Destination
Start-Process -FilePath $installer.Destination -ArgumentList $installer.Arguments -Wait
}
foreach($installer in $Installers)
{
if (Test-Path -LiteralPath $installer.InstalledPath)
{
Write-Verbose -Verbose "$($installer.SoftwareName) is already installed."
}
else
{
Install-Software -installer $installer
}
}
我已经编写了一个用于下载和安装 Microsoft Office 16 补丁程序的 PowerShell 脚本,该脚本还可以下载补丁程序并生成 exe,但是当我双击 exe 文件时,我收到以下消息,因为此应用程序无法在此 Windows 平台上支持(我是使用 Windows 10)但是当我手动下载它时,它正在安装。如果是,请告诉我,他们在剧本中是否有任何错误。感谢您
解决方案
推荐阅读
- amazon-web-services - 我可以在同一个 beanstalk 环境中使用单独的应用程序包发布 2 个站点吗?
- python - 从 JSON 中消除不必要的部分
- php - DQL 子查询问题预期文字,得到“选择”
- sorting - Google Data Studio 中的两个日期过滤器
- c++ - 菜单计算器中的组织
- c++ - 在 Cuda 内核中使用 c++ 对象和类成员
- java - 执行代码时应用程序最小化
- web-scraping - 问题 HTTP 状态码未处理或不允许?
- r - 使用性能包删除异常值时出现 Filtered_data 错误
- kubernetes - k8s集群角色创建无法获得正确的权限