SCCM office 365 update Error 0x80040154 ( -2147221164 ), class not registered

How to fix this issue with SCCM office 365 update Error 0x80040154 (-2147221164), class not registered

I had this issues recently to patch – upgrade office 365 on freshly new deployed computers. After some research I found a solution to fix my computers, a script to re-register the  OfficeC2RCom. The script is provided in this article.

On the windows 10 client, office 365 update failed with error Error 0x80040154 ( -2147221164 )

SCCM-office-update-error

On SCCM server, deployment status

SCCM-office-Deployment-error-0x80040154

 

On the details of the deployment, error 0x80040154 , class not registered

deployment_error_details_0x80040154

 

On windows 10 computer

UpdatesHandler.log

Bundle update (1889820d-3d3f-4fa8-b5b6-dabeb577d930) is requesting download from child updates for action (INSTALL)            UpdatesHandler               08/03/2019 12:01:52       7968 (0x1F20)

Ignoring update state (DOWNLOAD_READY) change in job state (2)           UpdatesHandler               08/03/2019 12:01:52                7300 (0x1C84)

Starting download on action (INSTALL) for Alternate Update (747f1043-9ca8-4fba-a1dd-98a5dd4f2eb9)                UpdatesHandler               08/03/2019 12:01:52       7968 (0x1F20)

BeginDownload alternate update content failed. Error = 0x80040154         UpdatesHandler               08/03/2019 12:01:52                7968 (0x1F20)

CBundledUpdate -- Failed to download update (747f1043-9ca8-4fba-a1dd-98a5dd4f2eb9). Error = 0x80040154                UpdatesHandler               08/03/2019 12:01:52       7968 (0x1F20)

Ignoring update state (DOWNLOAD_READY) change in job state (2)           UpdatesHandler               08/03/2019 12:01:52                12536 (0x30F8)

CDeploymentJob -- Failed to download update (1889820d-3d3f-4fa8-b5b6-dabeb577d930). Error = 0x80040154                UpdatesHandler               08/03/2019 12:01:52       7968 (0x1F20)

 

AlternateHandler.log

BeginDownload: AlternateDownloadSettings=    AlternateHandler             08/03/2019 12:01:52       12136 (0x2F68)

InitializeAltAgent...         AlternateHandler             08/03/2019 12:01:52       12136 (0x2F68)

Input AgentAppId={b7f1785f-d69b-46f1-92fc-d2de9c994f13}, and __uuidof(UpdateNotifyObject)={B7F1785F-D69B-46F1-92FC-D2DE9C994F13}          AlternateHandler             08/03/2019 12:01:52       12136 (0x2F68)

CreateInstance failed for UpdateNotifyObject. Error = 0x80040154             AlternateHandler             08/03/2019 12:01:52                12136 (0x2F68)

Failed to InitializeAltAgent error = 0x80040154    AlternateHandler             08/03/2019 12:01:52       12136 (0x2F68)

CleanupDownload...       AlternateHandler             08/03/2019 12:01:52       12136 (0x2F68)

 

Sctipt:

# Remove the COM+ Application which was hosting the UpdateNotify.Object
Write-Host "Remove the OfficeC2RCom COM+ App if exists"
$comCatalog = New-Object -ComObject COMAdmin.COMAdminCatalog
$appColl = $comCatalog.GetCollection("Applications")
$appColl.Populate()

foreach($app in $appColl)
{
    if ($app.Name -eq "OfficeC2RCom")
    {
      $appColl.Remove($index)
      $appColl.SaveChanges()
    }
    $index++
}

# Create a COM+ application to host UpdateNotify.Object
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection("Applications")
$apps.Populate();


$newComPackageName = "OfficeC2RCom"

$app = $apps | Where-Object {$_.Name -eq $newComPackageName}

if ($app)
{
    # OfficeC2RCom app already exists. Output some info about it
    Write-Host ""
    $appname = $app.Value("Name")
    "This COM+ Application already exists : $appname"
    Write-Host ""

    "ID: " +  $app.Value("ID")
    "Identity: " +  $app.Value("Identity")
    "ApplicationDirectory: " + $app.Value("ApplicationDirectory")
    "ConcurrentApps:" + $app.Value("ConcurrentApps")
    "RecycleCallLimit:" + $app.Value("RecycleCallLimit")
    "Activation:" + $app.Value("Activation")
    "ApplicationAccessChecksEnabled:" + $app.Value("ApplicationAccessChecksEnabled")
    Write-Host ""
}
Else
{
    # OfficeC2RCom app doesn't exist, creat it

    # Add the App
    Write-Host "Adding OfficeC2RCom COM+ Application..."

    Try
    {
      $app = $apps.Add()
      $app.Value("Name") = $newComPackageName
      $app.Value("Identity") = "NT AUTHORITY\LocalService"
      $app.Value("ApplicationAccessChecksEnabled") = 1
      $app.Value("ID") = "{F6B836D9-AF6A-4D05-9A19-E906A0F34770}"
      $saveChangesResult = $apps.SaveChanges()
      "Results of the Apps SaveChanges operation : $saveChangesResult"

      $appid = $app.Value("ID")

      # Adding roles
      Write-Host "Adding Administrator role to $newComPackageName"
      $roles = $apps.GetCollection("Roles", $app.Key)
      $roles.Populate()
      $role = $roles.Add()
      $role.Value("Name") = "Administrator"
      $saveChangesResult = $roles.SaveChanges()
      "Results of the Roles SaveChanges operation : $saveChangesResult"

      # Get the localized string of the Builtin\Administrators
      $id = [System.Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid
      $Account = New-Object System.Security.Principal.SecurityIdentifier($id, $null)
      $localizedAdministrators = $Account.Translate([System.Security.Principal.NTAccount]).Value
      "Results of the localized administrators string : $localizedAdministrators"
      # Adding BUILTIN\Administrators to the Administrator Role
      $users = $roles.GetCollection("UsersInRole", $role.Key)
      $users.Populate()
      $user = $users.Add()
      $user.Value("User") = $localizedAdministrators
      $saveChangesResult = $users.SaveChanges()
      "Results of the Users SaveChanges operation : $saveChangesResult"
    }
    catch
    {
      Write-Host "Failed to add OfficeC2RCom as COM+ application." -ForegroundColor White -BackgroundColor Red
      exit
    }

    Write-Host "Successfully added COM+ application: $newComPackageName, id: $appid" -ForegroundColor Blue -BackgroundColor Green
}

# Adding the UpdateNotify.Object as the component of OfficeC2RCom
$comps = $apps.GetCollection("Components", $app.Key)
$comps.Populate()
$newCompName = "UpdateNotify.Object.1"

$comp = $comps | Where-Object {$_.Name -eq "UpdateNotify.Object.1"}

if ($comp)
{
  "The $newCompName already exists!"
}
Else
{
  Try
  {
    $comAdmin.ImportComponent($newComPackageName, $NewCompName)
  }
  catch
  {
      Write-Host "Failed to add $newCompName to $newComPackageName" -ForegroundColor White -BackgroundColor Red
      exit
  }
  Write-Host "Successfully added $newCompName to $newComPackageName" -ForegroundColor Blue -BackgroundColor Green
}

 

I have made a Task Sequence and applied this PowerShell script to all affected computers. Also some action I have included in out deployment TS, right now all new deployed computers are affected.

re-register-office-script

 

Easy, happy sccm-ing :)