Jump to content

Recommended Posts

Posted

Hello, we are having a problem with Office365 install erroring in the logs on:

 

Remove-appxprovisionedpackage Microsoft.Office.Desktop

 

That package doesn't actually exist, the install just never gives up trying to remove it, and hangs forever. So I was thinking to give it something to actually remove I will install the Microsoft.Office.Desktop appx, can anyone advise how I do this? PowerShell seems to need a source and a license.

Posted

Hi,

Wouldn't the most effective thing be to only remove it if its installed?

Something like this?

get-appxprovisionedpackage -online | ?{$_.displayname -match "Microsoft.Office.Desktop"} | remove-appxprovisionedpackage

Posted
Thanks, a bit more context - Microsoft.Office.Desktop doesn't exist in my base Windows package. The Office365 install is erroring trying to remove it, you would have thought it would try, find it not there and move on, but the install hangs forever. So my thoughts were to give it to the package to remove - but how do I install it?
Posted

How far down the deployment route are you? I'm assuming you're using a Windows image that has had some of the pre-provisioned crap removed. The easiest way to fix this is to use a windows image that hasn't had Microsoft.Office.Desktop removed and deploy that tbh.

 

Otherwise, you'll need to find the .appxbundle and associated XML license file (have a snoop around %PROGRAMFILES%\WindowsApps and %PROGRAMFILES%\WindowsApps\DeletedAllUserPackages for starters) and try and reinstall using that (code below using OneNote as an example). I've done it before, but it can be very hit and miss.

 

Add-AppxProvisionedPackage -Online -PackagePath "$PSScriptRoot\Microsoft.Office.OneNote_16001.11126.20076.0_neutral___8wekyb3d8bbwe.AppxBundle" –LicensePath "$PSScriptRoot\Microsoft.Office.OneNote_8wekyb3d8bbwe_e336bb8f-16ed-7cbe-afee-971dd3041585.xml"

 

Is there anything in the config of your Office installer about removing previous versions first that perhaps you can switch off?

Posted

the base windows image has not had anything removed from it. I also can't see any Microsoft.Office.Desktop in WindowsApps.

 

If I can show you the error logged when installing office maybe you can offer a suggestion we haven't thought of to get office installed. NB - We are using the ODT as a source and the latest setup.exe. Have tried a local source too. And both windows 10 and 11.

 

04/18/2024 17:16:25.849 OFFICECL (0x1d2c) 0x12b4 Click-To-Run Non Task Error c0dow Unexpected InspectorToolDeployment::ToolScratchWrapper {"MachineId": "97e5222f6ce61f4fad05433c7d286233", "SessionID": "a081b5ce-0767-48bf-ba85-0aacc3df4526", "GeoID": 242, "Ver": "16.0.17328.20282", "C2RClientVer": "16.0.17328.20282", "ErrorCode": 0, "ErrorType": "", "AppVErrorSource": "", "ErrorMessage": "", "ErrorDetails": "", "ContextData": "{"message":"Run Inspector tool process","Process":"InspectorOfficeGadget.exe","Command":"deprovisionuninstall --displayname \"Microsoft.Office.Desktop\" --logfile \"C:\\\\windows\\\\TEMP\\\\Office.DeprovisionError.scratch\"","Message":"Exception: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component."}"}

 

tries this 3 times, then it tries to remove the same Appx using Powershell and fails every 10 minutes forever.

 

04/18/2024 17:46:34.645 OFFICECL (0x1d2c) 0x12b4 Click-To-Run Non Task Error c0doz Unexpected PowerShellDeployment::SideloadUninstall {"MachineId": "97e5222f6ce61f4fad05433c7d286233", "SessionID": "a081b5ce-0767-48bf-ba85-0aacc3df4526", "GeoID": 242, "Ver": "16.0.17328.20282", "C2RClientVer": "16.0.17328.20282", "ErrorCode": 0, "ErrorType": "", "AppVErrorSource": "", "ErrorMessage": "", "ErrorDetails": "", "ContextData": "{"message":"Failed to use PowerShell deprovision Appx package","Error":"Remove-AppxProvisionedPackage : Cannot bind argument to parameter 'PackageName' because it is null."}"}

 

 

this

Thanks

Posted
More use might be the version of Windows you're trying to deploy to, and the version of Office, including the contents of your Office installer configuration XML?
Posted

We have tried both Windows 10 and Windows 11 latest versions downloaded from MS licensing.

Installing latest Office365 from CDN.

 

Nothing else installed. Here's the .xml:

 

Posted

You could try adding this line into your XML. It controls whether the installer tries to remove other versions of office when it runs.

 

 

Posted
I don't think it makes much different where in the XML file, as long as it's on it's own line and at the top level in the XML structure.
  • 6 months later...
Posted

Petben, did you ever find a solution? We are having the same exact problem, both with Office 365 and even the LTSC 2024 version which we have a few volume licenses. It's the exact same issue, it only occurs when it's being installed via computer startup script. The script works fine when ran under an interactive user account (with admin rights of course). It always gets stuck on the UNINSTALLCENTENNIAL task, despite the fact the the logs even show that it looks for and fails to locate it installed on the PC anyway. As you say, it tries every 10 minutes until Group Policy finally gives up and terminates the script.

 

Thanks!

Posted

Hello, I think we did.

 

Noticed that if we remotely started the Windows Installer service the hanging install got going again. then we found simply putting a start service command in the install script still failed as the service seemed to stop randomly. so we put a block of script in that starts the service as a background job, monitors it, starting again if it stops. then a bit of output at the end.

 

i'll be interested in your findings. I assume you have -full in the office install .xml to make it easier to see progress bar.

 

# Start service
$StartServiceJob = {
   While (1) {
       If((Get-Service -Name TrustedInstaller).Status -ne 'Running') {
           Write-Host "$((get-date).ToLongTimeString()) - Starting Trusted Installer service as it was not running. "
           Start-Service -Name TrustedInstaller
           Get-Service -Name TrustedInstaller
       } else {
           Write-Host "$((get-date).ToLongTimeString()) - Service already running..."
       }
       Start-Sleep 10
   }
}

# Start-Job starts a background job on the local computer that runs a command without interacting with the current session.
Start-Job $StartServiceJob

# Install new version
Write-Host "Installing new version of Office365" -ForegroundColor Yellow
Start-Process "\\domain\msi\Office\Office365\Deployment\setup.exe" -ArgumentList '/configure "\\domain\msi\Office\Office365\Deployment\Office365Config.xml"' -Wait

Write-Host ""
Write-Host "Office install finished."
Write-Host "Results from output:"

Get-Job | Receive-Job

Write-Host "Stopping and removing job"
Get-Job | Stop-Job
Get-Job | Remove-Job

  • Like 1
  • Thanks 1
Posted (edited)

That's it! I confirmed that if I manually started the 'Windows Modules Installer' service (AKA TrustedInstaller) that the 'UNINSTALLCENTENNIAL' task finishes within a short period of time. I played around with the service and determined that it normally doesn't run (set to 'Manual' startup) and launches when needed or requested, but for some reason the Office task isn't telling it to do it, at least not during computer startup. I attempted to start the service before running the task, but the service shuts down after 2 minutes of inactivity and it usually takes longer than 2 minutes to get to that point in the installation, so I'll give your background task a try. I even tried to set the service to 'Automatic' temporarily but it still shuts down after 2 minutes, and in fact, even changes the startup type back to Manual as soon as it starts.

 

Thank you SO much for responding! As to your question, I normally have the 'Display Level' set to 'None' when I'm doing our installs, but I did change it to 'Full' while I was testing things, though it made no difference of course to the outcome.

Edited by CTGR-Jack
Posted (edited)

Petben, I finished creating my script for our Office rollout. It has some additional items on it along with the things that you recommended. I included some basic logging of the process along with recording the Exit Code from the install itself in case there are issues. Our script runs every time the computer boots up, but only runs the install if it detects that it's not already on there. This script is for Office 2024, but O365 just uses a different registry key to check, but other than that it's exactly the same. Thanks and take care!

 

#Set ProductName to Registry Value in Uninstall Key
$ProductName="ProPlus2024Volume - en-us"

#Set DeployServer to a network-accessible location containing the Office setup.exe installer.
$DeployServer="\\domain.local\dfsroot\Software\MSOffice2024"

#Set ConfigFile to the configuration file to be used for deployment (required)
$ConfigFile="\\domain.local\dfsroot\Software\MSOffice2024\Office2024.xml"

$LogLocation="\\domain.local\dfsroot\Software\MSOffice2024\LogFiles"


# Start service
$StartServiceJob = {
   While (1) {
       If((Get-Service -Name TrustedInstaller).Status -ne 'Running') {
           Write-Host "$((get-date).ToLongTimeString()) - Starting Trusted Installer service as it was not running. "
           Start-Service -Name TrustedInstaller
           Get-Service -Name TrustedInstaller
       } else {
           Write-Host "$((get-date).ToLongTimeString()) - Service already running..."
       }
       Start-Sleep 10
   }
}

#Check for Office, Exit if True
$RegCheck = Test-Path -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$($ProductName)"
#$RegCheck = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$($ProductName)" -ErrorAction SilentlyContinue
If ($RegCheck) { Exit }

#Log Start
"$(get-date) Begin Office 2024 Install" | Out-File -FilePath "$($LogLocation)\$($env:COMPUTERNAME).txt" -Append -Encoding ASCII 
# Start-Job starts a background job on the local computer that runs a command without interacting with the current session.
Start-Job $StartServiceJob

Clear-Host

# Install new version
Write-Host "Installing Office 2024, please wait...." -ForegroundColor White
$Process = Start-Process "\\domain.local\dfsroot\software\MSOffice2024\setup.exe" -ArgumentList "/configure $($ConfigFile)" -Wait -PassThru -WindowStyle Minimized
#Log End
"$(get-date) Setup ended with error code $($Process.ExitCode)" | Out-File -FilePath "$($LogLocation)\$($env:COMPUTERNAME).txt" -Append -Encoding ASCII

#Remove Job
Write-Host "Stopping and removing job"
Get-Job | Stop-Job
Get-Job | Remove-Job

Edited by CTGR-Jack
  • Like 1
  • 6 months later...
Posted

Great fix, thank you. Looks like Microsoft may not officially support running ODT in the LOCAL SYSTEM context (as @petben found in previous posts below) but this is still a great fix!

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...