Remotely Install available OS update from Software center

Hello All,

can someone help me how can I install available OS update from Software center on remote computer.

Usually these are pushed from SCCM and I would like to install on the client machine and it is on Operating systems tab of Software center.

Here is something I wrote time ago for this purpose:

if (Test-Connection -TargetName $ComputerName -Count 1 -TimeoutSeconds 1 -Quiet) {
    $NewPSSessionParams = @{
        ComputerName = $ComputerName
    if ($Credential) {
        $NewPSSessionParams.Credential = $Credential
    $PSSession = New-PSSession @NewPSSessionParams
    Invoke-Command -Session $PSSession -ScriptBlock {
        try {
            $GetCimInstanceParams = @{
                NameSpace   = 'ROOT\ccm\ClientSDK'
                ClassName   = 'CCM_SoftwareUpdate'
                Filter      = 'ComplianceState = 0'
                ErrorAction = 'Stop'
            $InvokeCimMethodParams = @{
                Namespace   = 'ROOT\ccm\ClientSDK' 
                ClassName   = 'CCM_SoftwareUpdatesManager'
                MethodName  = 'InstallUpdates'
                Arguments   = @{ 
                    CCMUpdates = [ciminstance[]](Get-CimInstance @GetCimInstanceParams | Where-Object -Property 'ArticleID' -NotIn -Value $USING:ExcludeArticleID) 
                ErrorAction = 'Stop'
            Invoke-CimMethod @InvokeCimMethodParams
        catch {
            throw $_
            Write-Error "Error activating updates on '$($ComputerName)'"
    Remove-PSSession -Session $PSSession
else {
    Write-Warning -Message "Cannot connect to '$($ComputerName)'"

It’s been tested with PowerShell v 7.1.2.
$ComputerName is one or more computer names, $Credential is a credential object you can provide if needed to reach some computers if the account you’re currently using is not allowed and $ExcludeArticleID is one or more ArticleIDs you don’t want to install.