Office 365 (2016) click to run

//Office 365 (2016) click to run
Office 365 (2016) click to run 2016-02-09T17:07:50+00:00

The Toolkit Forums Deployment Scripts Office 365 (2016) click to run

  • Author
    Posts
  • john
    Participant
    Post count: 1
    #1112 |

    Hi,
    I would like to use the toolkit to remove Office 2010 and deploy Office 2016 with the click-to-run scripts. I already have the uninstall part figured out from the help file, but need assistance with the 2016 part.

    I have the shares(test and prod) and XML files ready. It deploys via \\server\share\setup.exe /configure office2012-prod.xml. It’s a silent install with parameters for what products to install, update path, etc.

    Is there a way to launch a commandline install while keeping the pop-up box in place? Also need a post-install removal of OneDrive, which may require commandline as well.

    Thanks, John

  • Jason
    Participant
    Post count: 3

    What popup box are you talking about? The O365 installation boxes, PSApp dialog boxes or Command prompt window? Not sure why you would want to show the Command Prompt window when you have the option of the other two. Also why post-install removal of OneDrive? You should be able to use <ExcludeApp ID=”Groove” /> to keep it from installing.

    Below is the script I use that I can either push out via SCCM or make it available for a user to install via the App Portal. My support guys also use this for manual installs when needed. It does show the dialog boxes for PSApp toolkit and the O365 windows during install when not doing a required install.

    This was created for migration to On-Premise to O365 so it’s built around removing Office version 2003 and up. We also have situations where we needed language packs or having the install configured in shared licensing mode so I added switches that would call different configuration files based on switch.

    Dunno if this will help you out on what you’re wanting.

    Edit: If you’re really wanting a post-install removal of OneDrive then you should be able to add a setup.exe /configure OneDriveRemoval.xml in the Post-Install section. You’d need to craft an xml file with <ExcludeApp ID=”Groove” /> in it. Not 100% on this but in theory should work.

    <#
    .SYNOPSIS
    This script performs the installation or uninstallation of an application(s).
    .DESCRIPTION
    The script is provided as a template to perform an install or uninstall of an application(s).
    The script either performs an “Install” deployment type or an “Uninstall” deployment type.
    The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
    The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
    .PARAMETER DeploymentType
    The type of deployment to perform. Default is: Install.
    .PARAMETER DeployMode
    Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive.
    .PARAMETER AllowRebootPassThru
    Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered.
    .PARAMETER TerminalServerMode
    Changes to “user install mode” and back to “user execute mode” for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
    .PARAMETER DisableLogging
    Disables logging to file for the script. Default is: $false.
    .EXAMPLE
    Deploy-Application.ps1
    .EXAMPLE
    Deploy-Application.ps1 -DeployMode ‘Silent’
    .EXAMPLE
    Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer
    .EXAMPLE
    Deploy-Application.ps1 -DeploymentType Uninstall
    .NOTES
    Toolkit Exit Code Ranges:
    60000 – 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
    69000 – 69999: Recommended for user customized exit codes in Deploy-Application.ps1
    70000 – 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
    .LINK
    http://psappdeploytoolkit.codeplex.com
    #>
    [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,
    [switch]$IsSharedPC = $false,
    [Parameter(Mandatory=$false)]
    [ValidateSet(‘ENUS’,’ALL’)]
    [string]$Language = ‘ENUS’

    )

    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 = ‘Office 365 ProPlus’
    [string]$appVersion = ‘16.0.6001.1061’
    [string]$appArch = ‘x86’
    [string]$appLang = ‘EN’
    [string]$appRevision = ‘1’
    [string]$appScriptVersion = ‘1.1.0’
    [string]$appScriptDate = ”
    [string]$appScriptAuthor = ”
    ##*===============================================

    ##* Do not modify section below
    #region DoNotModify

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

    ## Variables: Script
    [string]$deployAppScriptFriendlyName = ‘Deploy Application’
    [version]$deployAppScriptVersion = [version]’3.6.1′
    [string]$deployAppScriptDate = ’03/26/2015′
    [hashtable]$deployAppScriptParameters = $psBoundParameters

    ## Variables: Environment
    [string]$scriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent

    ## Dot source the required App Deploy Toolkit Functions
    Try {
    [string]$moduleAppDeployToolkitMain = “$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1”
    If (-not (Test-Path -Path $moduleAppDeployToolkitMain -PathType Leaf)) { Throw “Module does not exist at the specified location [$moduleAppDeployToolkitMain].” }
    If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
    }
    Catch {
    [int32]$mainExitCode = 60008
    Write-Error -Message “Module [$moduleAppDeployToolkitMain] failed to load: n$($_.Exception.Message)n `n$($_.InvocationInfo.PositionMessage)” -ErrorAction ‘Continue’
    Exit $mainExitCode
    }

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

    # Set the initial Office folder
    [string] $dirOffice = Join-Path -Path “$envProgramFilesX86” -ChildPath “Microsoft Office”
    [string] $dirOfficeC2R = Join-Path -Path “$envProgramFiles” -ChildPath “Microsoft Office 15”
    [string] $dirOfficeX64 = Join-Path -Path “$envProgramFiles” -ChildPath “Microsoft Office”
    [string] $dirOfficeC2RX86 = Join-Path -Path “$envProgramFilesX86” -ChildPath “Microsoft Office 15”

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

    ## Show Welcome Message, close IE and all office apps, verify there is enough disk space to complete the install, and persist the prompt
    Show-InstallationWelcome -CloseApps ‘officeclicktorun,ose,osppsvc,sppsvc,msoia,excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio,iexplore’ -Silent -CheckDiskSpace -PersistPrompt

    ## Show Progress Message
    Show-InstallationProgress -StatusMessage “Office 365 Installation in Progress…The Installation may take up to 45 minutes to complete.” -TopMost $False

    ## Display Pre-Install cleanup status
    Show-InstallationProgress -StatusMessage “Performing Pre-Install cleanup. Removing Prior Office Versions… This may take some time. Please wait…”

    # Remove any previous version of Office (if required)
    [string[]]$officeExecutables = ‘excel.exe’, ‘groove.exe’, ‘infopath.exe’, ‘onenote.exe’, ‘outlook.exe’, ‘mspub.exe’, ‘powerpnt.exe’, ‘winword.exe’
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOffice -ChildPath “Office11\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2003 was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path ‘cscript.exe’ -Parameters “"$dirSupportFiles\OffScrub03.vbs” ALL /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,16,42’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOffice -ChildPath “Office12\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2007 was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path ‘cscript.exe’ -Parameters “"$dirSupportFiles\OffScrub07.vbs” ProPlus,Pro,Standard /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,16,42’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOffice -ChildPath “Office14\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2010 was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “"$dirSupportFiles\OffScrub10.vbs” ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,16,42’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOffice -ChildPath “Office15\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2013 was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “"$dirSupportFiles\OffScrub_O15msi.vbs” ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,16,42’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOfficeC2R -ChildPath “root\Office15\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2013 C2R was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “"$dirSupportFiles\OffScrub_O15c2r.vbs” ALL /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,42,34,67’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOfficeX64 -ChildPath “Office14\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2010 was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “"$dirSupportFiles\OffScrub10.vbs” ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,16,42’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOfficeX64 -ChildPath “Office15\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2013 was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “"$dirSupportFiles\OffScrub_O15msi.vbs” ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,16,42’
    Break
    }
    }
    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOfficeC2RX86 -ChildPath “root\Office15\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2013 C2R was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “"$dirSupportFiles\OffScrub_O15c2r.vbs” ALL /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,42,34,67’
    Break
    }
    }

    ##*===============================================
    ##* INSTALLATION
    ##*===============================================
    [string]$installPhase = ‘Installation’

    ## Handle Zero-Config MSI Installations
    If ($useDefaultMsi) { Execute-MSI -Action ‘Install’ -Path $defaultMsiFile }

    ## <Perform Installation tasks here>

    ## Check if Installing in Shared Computer Mode
    If (-not $IsSharedPC) {
    If ($Language -eq ‘ENUS’) {
    Show-InstallationProgress -StatusMessage ‘Installing Office 365 ProPlus. This may take some time. Please wait…’ -TopMost $True
    Execute-Process -Path “$dirFiles\Setup.exe” -Parameters “/CONFIGURE ProPlus32.xml”
    }
    If ($Language -eq ‘ALL’) {
    Show-InstallationProgress -StatusMessage ‘Installing Office 365 ProPlus. This may take some time. Please wait…’ -TopMost $True
    Execute-Process -Path “$dirFiles\Setup.exe” -Parameters “/CONFIGURE ProPlus32_ALL.xml”
    }
    }

    If ($IsSharedPC) {
    If ($Language -eq ‘ENUS’) {
    Show-InstallationProgress -StatusMessage ‘Installing Office 365 ProPlus. This may take some time. Please wait…’ -TopMost $True
    Execute-Process -Path “$dirFiles\Setup.exe” -Parameters “/CONFIGURE ProPlus32_SharedPC.xml”
    }
    If ($Language -eq ‘ALL’) {
    Show-InstallationProgress -StatusMessage ‘Installing Office 365 ProPlus. This may take some time. Please wait…’ -TopMost $True
    Execute-Process -Path “$dirFiles\Setup.exe” -Parameters “/CONFIGURE ProPlus32_SharedPC_ALL.xml”
    }
    }

    ##*===============================================
    ##* POST-INSTALLATION
    ##*===============================================
    [string]$installPhase = ‘Post-Installation’

    ## <Perform Post-Installation tasks here>

    ## Display a message at the end of the install
    ## Display a message at the end of the install
    Show-InstallationPrompt -Message “Office 365 ProPlus Installation is complete.” -ButtonRightText ‘OK’ -Icon Information -NoWait

    }
    ElseIf ($deploymentType -ieq ‘Uninstall’)
    {
    ##*===============================================
    ##* PRE-UNINSTALLATION
    ##*===============================================
    [string]$installPhase = ‘Pre-Uninstallation’

    ## Show Welcome Message,
    Show-InstallationWelcome -CloseApps ‘excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio,iexplore’ -Silent

    ## 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) { Execute-MSI -Action ‘Uninstall’ -Path $defaultMsiFile }

    # <Perform Uninstallation tasks here>
    Show-InstallationProgress -StatusMessage ‘Uninstalling Office 365 ProPlus. This may take some time. Please wait…’
    Execute-Process -Path “$dirFiles\Setup.exe” -Parameters “/CONFIGURE Remove.xml”

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

    ## <Perform Post-Uninstallation tasks here>
    Show-InstallationPrompt -Message “Office 365 ProPlus uninstallation has completed. Your Computer will need to be restarted. You will recieve a prompt scheduling a restart” -ButtonRightText ‘OK’ -Icon Information -NoWait

    }

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

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

    • This reply was modified 1 year, 8 months ago by  Jason.
    • Jose
      Participant
      Post count: 3

      Hi Jason,

      I know this forum is 4 weeks old but I stumbled upon it in my search to finding a way to use the deployment toolkit to install Office 365 2016. I saw your setup but I can’t seem to get mine to work. I keep receiving an error balloon stating “Installation Failed” from the taskbar. Not sure what I am missing but here is the script I developed. Can you or anyone else see where am I going wrong? I already placed all of the files for office install (ie. setup.exe and the .xml) within the same folder as the “Deploy-Application.ps1″.

      <pre class=”brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”><#
      .SYNOPSIS
      This script performs the installation or uninstallation of an application(s).
      .DESCRIPTION
      The script is provided as a template to perform an install or uninstall of an application(s).
      The script either performs an “Install” deployment type or an “Uninstall” deployment type.
      The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
      The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
      .PARAMETER DeploymentType
      The type of deployment to perform. Default is: Install.
      .PARAMETER DeployMode
      Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive.
      .PARAMETER AllowRebootPassThru
      Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered.
      .PARAMETER TerminalServerMode
      Changes to “user install mode” and back to “user execute mode” for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
      .PARAMETER DisableLogging
      Disables logging to file for the script. Default is: $false.
      .EXAMPLE
      powershell.exe -Command “& { & ‘.\Deploy-Application.ps1’ -DeployMode ‘Silent’; Exit $LastExitCode }”
      .EXAMPLE
      powershell.exe -Command “& { & ‘.\Deploy-Application.ps1’ -AllowRebootPassThru; Exit $LastExitCode }”
      .EXAMPLE
      powershell.exe -Command “& { & ‘.\Deploy-Application.ps1’ -DeploymentType ‘Uninstall’; Exit $LastExitCode }”
      .EXAMPLE
      Deploy-Application.exe -DeploymentType “Install” -DeployMode “Silent”
      .NOTES
      Toolkit Exit Code Ranges:
      60000 – 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
      69000 – 69999: Recommended for user customized exit codes in Deploy-Application.ps1
      70000 – 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
      .LINK

      The Toolkit


      #>
      [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 = ‘Office 2016’
      [string]$appVersion = ‘16.0.6001.1068’
      [string]$appArch = ‘x86’
      [string]$appLang = ‘EN’
      [string]$appRevision = ’01’
      [string]$appScriptVersion = ‘1.0.0’
      [string]$appScriptDate = ’04/06/2016′
      [string]$appScriptAuthor = ‘IT’
      ##*===============================================
      ## Variables: Install Titles (Only set here to override defaults set by the toolkit)
      [string]$installName = ”
      [string]$installTitle = ”

      ##* Do not modify section below
      #region DoNotModify

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

      ## Variables: Script
      [string]$deployAppScriptFriendlyName = ‘Deploy Application’
      [version]$deployAppScriptVersion = [version]’3.6.8′
      [string]$deployAppScriptDate = ’02/06/2016′
      [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 ‘WINWORD,EXCEL,OUTLOOK,POWERPNT,ONENOTE,MSPUB,NitroPDF’ -BlockExecution -AllowDefer -CheckDiskSpace -PersistPrompt -CloseAppsCountdown 60

      ## Show Progress Message (with the default message)
      Show-InstallationProgress -StatusMessage “Office 365 Installation in Progress…The Installation may take up to 45 minutes to complete.”

      ## <Perform Pre-Installation tasks here>

      ##*===============================================
      ##* INSTALLATION
      ##*===============================================
      [string]$installPhase = ‘Installation’

      ## Handle Zero-Config MSI Installations
      If ($useDefaultMsi) {
      [hashtable]$ExecuteDefaultMSISplat = @{ Action = ‘Install’; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add(‘Transform’, $defaultMstFile) }
      Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action ‘Patch’ -Path $_ } }
      }

      ## <Perform Installation tasks here>
      ##Show-InstallationProgress -StatusMessage “Upgrading to the NEW Office 2016. Please wait while installation completes…”
      Execute-Process -Path “.\Setup.exe” -Parameters “/configure /configuration.xml”

      ##*===============================================
      ##* POST-INSTALLATION
      ##*===============================================
      [string]$installPhase = ‘Post-Installation’

      ## <Perform Post-Installation tasks here>

      ## Display a message at the end of the install
      If (-not $useDefaultMsi) { Show-InstallationPrompt -Message ‘Your Office Upgrade has been Completed. Should you have any questions, please call the Help Desk -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
      }

  • Jose
    Participant
    Post count: 3

    Hi Jason,

    I know this forum is 4 weeks old but I stumbled upon it in my search to finding a way to use the deployment toolkit to install Office 365 2016. I saw your setup but I can’t seem to get mine to work. I keep receiving an error balloon stating “Installation Failed” from the taskbar. Not sure what I am missing but here is the script I developed. Can you or anyone else see where am I going wrong? I already placed all of the files for office install (ie. setup.exe and the .xml) within the same folder as the “Deploy-Application.ps1″.

    <pre class=”brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”><#
    .SYNOPSIS
    This script performs the installation or uninstallation of an application(s).
    .DESCRIPTION
    The script is provided as a template to perform an install or uninstall of an application(s).
    The script either performs an "Install" deployment type or an "Uninstall" deployment type.
    The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
    The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
    .PARAMETER DeploymentType
    The type of deployment to perform. Default is: Install.
    .PARAMETER DeployMode
    Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive.
    .PARAMETER AllowRebootPassThru
    Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered.
    .PARAMETER TerminalServerMode
    Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
    .PARAMETER DisableLogging
    Disables logging to file for the script. Default is: $false.
    .EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeployMode 'Silent'; Exit $LastExitCode }"
    .EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -AllowRebootPassThru; Exit $LastExitCode }"
    .EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeploymentType 'Uninstall'; Exit $LastExitCode }"
    .EXAMPLE
    Deploy-Application.exe -DeploymentType "Install" -DeployMode "Silent"
    .NOTES
    Toolkit Exit Code Ranges:
    60000 – 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
    69000 – 69999: Recommended for user customized exit codes in Deploy-Application.ps1
    70000 – 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
    .LINK

    The Toolkit


    #>
    [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 = 'Office 2016'
    [string]$appVersion = '16.0.6001.1068'
    [string]$appArch = 'x86'
    [string]$appLang = 'EN'
    [string]$appRevision = '01'
    [string]$appScriptVersion = '1.0.0'
    [string]$appScriptDate = '04/06/2016'
    [string]$appScriptAuthor = 'IT'
    ##*===============================================
    ## Variables: Install Titles (Only set here to override defaults set by the toolkit)
    [string]$installName = ''
    [string]$installTitle = ''

    ##* Do not modify section below
    #region DoNotModify

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

    ## Variables: Script
    [string]$deployAppScriptFriendlyName = 'Deploy Application'
    [version]$deployAppScriptVersion = [version]'3.6.8'
    [string]$deployAppScriptDate = '02/06/2016'
    [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 'WINWORD,EXCEL,OUTLOOK,POWERPNT,ONENOTE,MSPUB,NitroPDF' -BlockExecution -AllowDefer -CheckDiskSpace -PersistPrompt -CloseAppsCountdown 60

    ## Show Progress Message (with the default message)
    Show-InstallationProgress -StatusMessage “Office 365 Installation in Progress…The Installation may take up to 45 minutes to complete.”

    ## <Perform Pre-Installation tasks here>

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

    ## Handle Zero-Config MSI Installations
    If ($useDefaultMsi) {
    [hashtable]$ExecuteDefaultMSISplat = @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
    Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
    }

    ## <Perform Installation tasks here>
    ##Show-InstallationProgress -StatusMessage "Upgrading to the NEW Office 2016. Please wait while installation completes…"
    Execute-Process -Path “.\Setup.exe” -Parameters “/configure /configuration.xml”

    ##*===============================================
    ##* POST-INSTALLATION
    ##*===============================================
    [string]$installPhase = 'Post-Installation'

    ## <Perform Post-Installation tasks here>

    ## Display a message at the end of the install
    If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'Your Office Upgrade has been Completed. Should you have any questions, please call the Help Desk at (954)627-9353' -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
    }

    • This reply was modified 1 year, 7 months ago by  Jose.
  • Dan
    Participant
    Post count: 13

    Great script! I’ve been going nuts with trying to do it the microsoft way. Keep getting stupid errors.
    Anyway, how are you triggering the “ifshared” switch?

    Also, have you come up with any switches to add to this script to add additional apps such as Visio and Project? We are installing the base software (minus groove/onedrive and access) but would like to utilize this script to add visio or project with a switch.

    Thoughts?

  • Aldin
    Participant
    Post count: 12

    This is my script that I use to upgrade any previous Office version to Office 365 ProPlus 2016 CLick to Run.

    We have PC’s with Office 2007, 2010 and 2013.
    As we are planning to upgrade all of them to the latest version I’ve created this script that will do just that.
    I used a couple of snippets from the example script as it contained some useful stuff.
    I’ve also made interactive so our users receive an informational message of what’s going to happen.

    The script first scans for installed Office version and removes them before installing new version.
    I use these Offscrub files:

    OffScrub03.vbs
    OffScrub07.vbs
    OffScrub10.vbs
    OffScrub_O15msi.vbs
    OffScrubc2r.vbs

    For your reference, here is the folder structure of the PsAppDeploykit working directory:
    [IMG]http://i66.tinypic.com/23r0310.png[/IMG]

    I’ve deployed it via SCCM 2012:
    Installation program: Deploy-Application.exe -DeploymentType Install -DeployMode Interactive

    For the “interactive” part don’t forget to change the “User Experience” to:

    As the formatting will probably be screwed when I post the script here, I’m sharing the complete working directory with you (except the Office source files).
    -> All Offscrub files as well as my XML files that I’ve used.
    https://drive.google.com/open?id=0B1RmM7netsG3ZlRMUVdfd2d5UWs

    If you don’t want to download the source files, I’ve posted the script also on the Technet forums:
    https://social.technet.microsoft.com/Forums/office/en-US/aa81d5a8-779a-482c-9c02-e187ab5d635f/office-2010-x64-x86-removal?forum=officesetupdeploy#32c80aac-09e7-42bd-b373-712f1aa47807

    • This reply was modified 1 year, 3 months ago by  Aldin.
    • Marcus
      Participant
      Post count: 2

      Hi Aldin,

      great Package. Could you please give me a hint, how to deal with multiple configuration.xmls for different languages.
      I have a package containing all language packs that i need and created for each language a seperate configuration XML (e. g. en-us.xml, pt-pt.xml, de-de.xml). Now I have the Problem to call the right language based on the current OS language or formerly installed Office Language. Any ideas.
      Thank in advance.

      • This reply was modified 7 months ago by  Marcus.
    • Shaun
      Participant
      Post count: 1

      According to the documentation, there is a toolkit variable called $currentLanguage that contains the two-letter language name of the target system (e.g., EN, FR, DE, etc). Could maybe do something like:

      Execute-Process -Path “$dirFiles\Setup.exe” -Parameters “/configure $currentLanguage.xml”

    • Marcus
      Participant
      Post count: 2

      Hi Shaun,
      thanks for that hint. I also figured out that variable today morning, but had a different way. I have used the if statement and called each config.xml in a separate step. Your proposal sounds better. Will try it as soon as possible.

      Many thanks and best regards.

    • Matthew
      Participant
      Post count: 1

      First off, I would like to thank you Aldin for providing this script, so far it has been working really well. The only issue I am currently running into is that sometimes after the scrub runs(and it is usually OffScrubC2R) I will get “[Pre-Installation] :: Execution complete and the exit code [42] is being ignored.” and then it will go on to start installing office but the Office install hangs for the entire 2 hour window I have allotted the install via SCCM. After the 2 hour mark it is canceled and the installation fails. If I reboot the machine and run it again, it seems to work. I do have machines that get the same error, with OffScrubC2R, and it has no issues installing office. Any advice would be much appreciated, thank you.

  • Dean
    Participant
    Post count: 1

    hello Aldin,

    I’m running into some detection issues with your PADT when install Office 365 2016. I’ve essentially copied your .ps1 and deployed it to a few test machines in my environment. Most of my machines have Office 2013 (VL) with Skype 2015 installed. The office scrub works very well and rips out all Office that is initially on the machine.

    The part that gets stuck is shown in the logs files for PADT:

    [Pre-Installation] :: Bypassing Installation Prompt [Mode: NonInteractive]… This will install Microsoft Office 365 ProPlus 2016 for you. Please note that the installation can take up to 45 minutes.
    All previous Office versions will be uninstalled first.
    Save all your work and click OK to continue. Show-InstallationPrompt 4/17/2017 2:15:08 PM 1276 (0x04FC)

    [Pre-Installation] :: Evaluate disk space requirements. Show-InstallationWelcome 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Retrieve free disk space for drive [C:]. Get-FreeDiskSpace 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Free disk space for drive [C:]: [22014 MB]. Get-FreeDiskSpace 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Successfully passed minimum disk space requirement check. Show-InstallationWelcome 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Check for running application(s) [ose,osppsvc,sppsvc,msoia,excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio,iexplore]… Get-RunningProcesses 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Application(s) are not running. Get-RunningProcesses 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Finished checking running application(s). Get-RunningProcesses 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Microsoft Office 2010 was detected. Will be uninstalled. Deploy Application 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: [cscript.exe] successfully resolved to fully qualified path [C:\WINDOWS\system32\cscript.exe]. Execute-Process 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Working Directory is [C:\WINDOWS\system32]. Execute-Process 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Executing [C:\WINDOWS\system32\cscript.exe “C:\WINDOWS\ccmcache\4z\SupportFiles\OffScrub10.vbs” ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1]… Execute-Process 4/17/2017 2:15:13 PM 1276 (0x04FC)

    [Pre-Installation] :: Execution completed successfully with exit code [0]. Execute-Process 4/17/2017 2:17:42 PM 1276 (0x04FC)

    [Pre-Installation] :: Microsoft Office 2013 was detected. Will be uninstalled. Deploy Application 4/17/2017 2:17:42 PM 1276 (0x04FC)

    [Pre-Installation] :: [cscript.exe] successfully resolved to fully qualified path [C:\WINDOWS\system32\cscript.exe]. Execute-Process 4/17/2017 2:17:42 PM 1276 (0x04FC)

    [Pre-Installation] :: Working Directory is [C:\WINDOWS\system32]. Execute-Process 4/17/2017 2:17:42 PM 1276 (0x04FC)

    [Pre-Installation] :: Executing [C:\WINDOWS\system32\cscript.exe “C:\WINDOWS\ccmcache\4z\SupportFiles\OffScrub_O15msi.vbs” ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1]… Execute-Process 4/17/2017 2:17:42 PM 1276 (0x04FC)

    [Pre-Installation] :: Execution completed successfully with exit code [0]. Execute-Process 4/17/2017 2:21:39 PM 1276 (0x04FC)

    [Installation] :: [C:\WINDOWS\ccmcache\4z\Files\Setup.exe] is a valid fully qualified path, continue. Execute-Process 4/17/2017 2:21:39 PM 1276 (0x04FC)

    [Installation] :: Working Directory is [C:\WINDOWS\ccmcache\4z\Files]. Execute-Process 4/17/2017 2:21:39 PM 1276 (0x04FC)

    [Installation] :: Executing [C:\WINDOWS\ccmcache\4z\Files\Setup.exe /configure ProPlus-InstallConfig.xml]… Execute-Process 4/17/2017 2:21:39 PM 1276 (0x04FC)

    It gets stuck at this spot where its trying to install Office 365 2016 using the setup.exe with the /configure .xml file applied.

    On the computer that’s getting Office 365 installed, the basic UI shows up and it eventually shows that it completes the install. However the log file above still reports it as Executing. This makes the SCCM software center hang on “Installing” and the end user is forced to restart their machine in order to move on to installing other Office 365 apps like Visio Pro or Project Pro.

    Have you ran into this issue before? Is there some type of powershell timer that I can implement into the script to essentially “jolt” it to move on?

    Thanks
    Dean

    • Aldin
      Participant
      Post count: 12

      Hi,

      I’m sorry I just saw this message.
      Can you share your XML file with me?
      Also what version of ODT (Office Deployment Tool) are you using?

      I honestly didn’t have any similar issues.
      I’ve upgraded office on 800+ devices successfully without any major issues.

      • This reply was modified 6 months, 3 weeks ago by  Aldin.
    • Anwer
      Participant
      Post count: 10

      Thanks for posting this. Did you ever include the off16scrub to your script? I see its included in the files but not referenced in the script.

    • Aldin
      Participant
      Post count: 12

      Hi Anwer,

      I did not include it because we didn’t have Office 2016 MSI in our environment at the time.
      I did include in the file so others can just edit the script a little to include it.
      It shouldn’t be that hard.

You must be logged in to reply to this topic.