I'm looking for a way to install missing SCCM updates on remote computers using PowerShell.
I came across this function but can't get it to run on a remote computer any ideas?
function Install-MissingUpdate {
param (
$computer = "Remote-Computer"
)
([wmiclass]'ROOT\ccm\ClientSDK:CCM_SoftwareUpdatesManager').InstallUpdates([System.Management.ManagementObject[]] (
Get-WmiObject -Query 'SELECT * FROM CCM_SoftwareUpdate' -namespace 'ROOT\ccm\ClientSDK'))
}
That code doesn't even take into account the $Computer
parameter. I've updated the code to use the computer name parameter.
function Install-MissingUpdate {
[CmdletBinding()]
param (
$ComputerName = "Remote-Computer"
)
$UpdateList = [ManagementObject[]](Get-WmiObject -ComputerName $ComputerName -Query 'SELECT * FROM CCM_SoftwareUpdate' -Namespace ROOT\ccm\ClientSDK);
([wmiclass]"\\$ComputerName\ROOT\ccm\ClientSDK:CCM_SoftwareUpdatesManager").InstallUpdates($UpdateList);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.