Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用powershell远程安装windows更新_Powershell - Fatal编程技术网

使用powershell远程安装windows更新

使用powershell远程安装windows更新,powershell,Powershell,我正在尝试远程获取PC上windows更新的脚本,以下是我到目前为止收集的内容 Install-Module PSWindowsUpdate 我现在得到提示 cmdlet在命令管道位置1调用WUJob 提供以下参数的值: RunNow: 我只是不知道该为RunNow做些什么,如果有人能给我指出正确的方向或提供一些建议,我将不胜感激 我还尝试创建变量,并通过这种方式进行操作 $Nodes = "TRJWIN10-9" Invoke-WUJob -ComputerName $N

我正在尝试远程获取PC上windows更新的脚本,以下是我到目前为止收集的内容

Install-Module PSWindowsUpdate
我现在得到提示

cmdlet在命令管道位置1调用WUJob 提供以下参数的值:

RunNow:

我只是不知道该为RunNow做些什么,如果有人能给我指出正确的方向或提供一些建议,我将不胜感激

我还尝试创建变量,并通过这种方式进行操作

$Nodes = "TRJWIN10-9"
Invoke-WUJob -ComputerName $Nodes -Script {ipmo PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot} -RunNow -Confirm:$false | Out-File "\\TRJDC\logs\$Nodes-$(Get-Date -f yyyy-MM-dd)-MSUpdates.log -Force
但我遗漏了一些东西,因为它只是提示>>。
我想向节点添加更多计算机,但现在只想在1台PC上测试它。

您的第二个代码段在
-MSUpdates.log之后缺少一个
Invoke-WUInstall -ComputerName TRJWIN10-1 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File \\TRJDC\logs\PSWindowsUpdate.log  } 
-Confirm:$false -Verbose
$Nodes = "TRJWIN10-9"
Invoke-WUJob -ComputerName $Nodes -Script {ipmo PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot} -RunNow -Confirm:$false | Out-File "\\TRJDC\logs\$Nodes-$(Get-Date -f yyyy-MM-dd)-MSUpdates.log -Force