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
}