PSAppDeployToolkit says install is complete but no Office installed

Hello all,

Unlike many people out there I have been unable to get the Toolkit to install Office 365 successfully consistently. This is very odd.

I am currently running O365 build 10730.20422. I tested installing O365 12527.20988. First, it was incredibly difficult to get the string to run the configure.xml - one error after another. I finally got that line to work in the code below. I’m guessing it is wrong but it worked several times. I tested installing to my system three or four times and then all of a sudden it broke. Now PSADT says the Office install completes successfully but when I look for the Office executable none are there. It’s like Office did not install at all. I’m running it as Admin from Powershell and the only oddity I noted is the following:

[08-13-2020 17:10:31.846] [Initialization] [Get-RegistryKey] :: Registry key [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\MUI\Settings] does not exist. Return $null.

I’m completely new to this tool so I may not even know the right questions to ask. Below is my code.

[CmdletBinding()]
Param (
	[Parameter(Mandatory=$false)]
	[ValidateSet('Install','Uninstall')]
	[string]$DeploymentType = 'Install',
	[Parameter(Mandatory=$false)]
	[ValidateSet('Interactive','Silent','NonInteractive')]
	[string]$DeployMode = 'Interactive',
	[Parameter(Mandatory=$false)]
	[switch]$AllowRebootPassThru = $false,
	[Parameter(Mandatory=$false)]
	[switch]$TerminalServerMode = $false,
	[Parameter(Mandatory=$false)]
	[switch]$DisableLogging = $false
)

Try {
	## Set the script execution policy for this process
	Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}

	##*===============================================
	##* VARIABLE DECLARATION
	##*===============================================
	## Variables: Application
	[string]$appVendor = 'Microsoft'
	[string]$appName = 'Microsoft Office 2016'
	[string]$appVersion = '16.0.12527.20988'
	[string]$appArch = 'x64'
	[string]$appLang = 'EN'
	[string]$appRevision = '01'
	[string]$appScriptVersion = '1.0.0'
	[string]$appScriptDate = ''
	[string]$appScriptAuthor = '<author name>'
	##*===============================================
	## Variables: Install Titles (Only set here to override defaults set by the toolkit)
	[string]$installName = 'DFPS Office 365 Upgrade'
	[string]$installTitle = 'Office Pro Plus 2002 build 12527.20988'

	##* Do not modify section below
	#region DoNotModify

	## Variables: Exit Code
	[int32]$mainExitCode = 0

	## Variables: Script
	[string]$deployAppScriptFriendlyName = 'Deploy Application'
	[version]$deployAppScriptVersion = [version]'3.8.0'
	[string]$deployAppScriptDate = '23/09/2019'
	[hashtable]$deployAppScriptParameters = $psBoundParameters

	## Variables: Environment
	If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
	[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent

	## Dot source the required App Deploy Toolkit Functions
	Try {
		[string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
		If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
		If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
	}
	Catch {
		If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
		Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
		## Exit the script, returning the exit code to SCCM
		If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
	}

	#endregion
	##* Do not modify section above
	##*===============================================
	##* END VARIABLE DECLARATION
	##*===============================================

	If ($deploymentType -ine 'Uninstall') {
		##*===============================================
		##* PRE-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Installation'

		## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
		Show-InstallationWelcome -CloseApps 'OUTLOOK,WINWORD,EXCEL,POWERPNT,IEXPLORE,ONENOTE,MSPUB,LYNC,MSACCESS' 

		## Show Progress Message (with the default message)
		Show-InstallationProgress "Performing Pre-Install cleanup. This may take some time. Please wait..."
 
		## <Perform Pre-Installation tasks here>
		Cscript.exe "OffScrubC2R.vbs" ALL /Quiet /NoCancel
		

		##*===============================================
		##* INSTALLATION
		##*===============================================
		[string]$installPhase = 'Installation'

	    
		# Installing Office 365 Pro Plus
         Show-InstallationProgress "Installing Office 365 Pro Plus 2002 Build 12527.20988. This may take some time. Please wait..."
		 .\setup.exe /configure Office365_ProPlus_Configuration.xml
         #Execute-Process -FilePath ".\setup.exe" "/configure Office365_ProPlus_Configuration.xml" -WindowStyle Hidden
 
		##*===============================================
		##* POST-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Installation'

		## <Post-Installation tasks>
		
		$dir = "C:\users\Public\AppData\Roaming\Microsoft\Templates"
        if(!(Test-Path -Path $dir )){
        New-Item -ItemType directory -Path $dir
        }

        $dir = "C:\Users\Public\AppData\Local\Microsoft\Office"
        if(!(Test-Path -Path $dir )){
        New-Item -ItemType directory -Path $dir
        }

        $dir = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office"
        if(!(Test-Path -Path $dir )){
        New-Item -ItemType directory -Path $dir
        }
	
		#Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Access.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Excel.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OneNote 2016.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Outlook.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PowerPoint.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Publisher.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
        #Move-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Word.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\" -Force
		
		#Set Word Normal File with Custom DFPS Settings
        $Normal2016 = ".\Normal2016.dotm"
        $wordUI = ".\Word.officeui"

        Copy-Item -path $Normal2016 -Destination "D:\ITOnly\Drivers and Software\DFPS_Forms_Fix\" -Force
        Copy-Item -path $wordUI -Destination "D:\ITOnly\Drivers and Software\DFPS_Forms_Fix\" -Force

        $Destination = 'C:\users\*\AppData\Roaming\Microsoft\Templates\'
        Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Normal2016 -Destination $_ -Force -Recurse}

        $Destination = 'C:\Users\*\AppData\Local\Microsoft\Office\'
        Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $wordUI -Destination $_ -Force -Recurse}

		## Display a message at the end of the install
		If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'The update to Office 365 version 2002 is now complete! Click OK to close this pop-up.' -ButtonRightText 'OK' -Icon Information -NoWait }
	}
	ElseIf ($deploymentType -ieq 'Uninstall')
	{
		##*===============================================
		##* PRE-UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Uninstallation'

		## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing
		Show-InstallationWelcome -CloseApps 'iexplore' -CloseAppsCountdown 60

		## Show Progress Message (with the default message)
		Show-InstallationProgress

		## <Perform Pre-Uninstallation tasks here>


		##*===============================================
		##* UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Uninstallation'

		## Handle Zero-Config MSI Uninstallations
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
			Execute-MSI @ExecuteDefaultMSISplat
		}

		# <Perform Uninstallation tasks here>


		##*===============================================
		##* POST-UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Uninstallation'

		## <Perform Post-Uninstallation tasks here>


	}

	##*===============================================
	##* END SCRIPT BODY
	##*===============================================

	## Call the Exit-Script function to perform final cleanup operations
	Exit-Script -ExitCode $mainExitCode
}
Catch {
	[int32]$mainExitCode = 60001
	[string]$mainErrorMessage = "$(Resolve-Error)"
	Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
	Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
	Exit-Script -ExitCode $mainExitCode
}

Hi, welcome to the forums.

It looks like you have a mix of the log and the actual script. If possible, can you post them separated?

If it is all log, try putting the entire thing in a code block so it doesn’t split it up like it s now.

Edit: I get it now but if you edit the entire code to be in one code block so it is easier to read, that would be helpful.

I’ll get on and try and clean it up but there is no log - it is all the deploy-application.ps1 script.

Sorry - I can’t get the Blockquote to to put all the code in a block. Makes no sense. I’ve tried to do it several times.

Awesome - thanks! The line in question is this:

Blockquote# Installing Office 365 Pro Plus
Show-InstallationProgress “Installing Office 365 Pro Plus 2002 Build 12527.20988. This may take some time. Please wait…”
.\setup.exe /configure Office365_ProPlus_Configuration.xml

I wanted to put the whole thing up above though - in case there is something I missed.

I edited it for you.

Easiest way to to use Markdown and use three backticks (`) to enclose it.

Part of the initialization is to get the UI language and the error is failing on that. I am not sure how that could happen but there is where it is failing.

One of us will try to get back to you with some ideas a bit later.

Thanks. Any assistance would be great!

Well, easier to just look now than later, eh?

Certain errors will cause issues and the logging to stop so maybe it isn’t the actual registry key being not found and actually erroring out on your code.

The proper way for you to run setup.exe (assuming it and the XML are in $dirFiles would be:

Execute-Process -Path 'setup.exe' -Parameters '/configure Office365_ProPlus_Configuration.xml'

Try that instead and see what happens.

(For reference of the Execute-Process command, please check it out on the GitHub wiki.)

Thanks.

I tried that and it failed with the following:

Blockquote[08-13-2020 21:09:59.601] [Installation] [Execute-Process] :: Execution failed with exit code [-2146994713].

I can also post the logs. I don’t understand anything in them.

It means that setup.exe was started/ran but returned that exit code (any non-zero is considered fail).

Check the where you XML is – probably my mistake. Always better to be explicit with paths if you can. Try -Parameters "/configure $dirFiles\Office365_ProPlus_Configuration.xml".

Hey Cybermoloch - the line you gave me worked! Turns out I was having some sort of subscription issue after installing numerous versions of Office on my system during testing. As soon as I moved to a few other test systems everything was fine. Issue was my laptop/account.