none
Office 2010 x64 & x86 Removal

    Question

  • Hi,

    In preparation for an Office 2013 x86 upgrade, i have acquired OffScrub10.vbs in the hopes it will remove all previous versions.

    The current setup have Office 2010 (some 32-bit, some 64-bit) and Visio 2010 (some 32-bit, some 64-bit).

    I want to deploy this via sccm 2012.

    A few questions, will Offscrub10 be able to remove both 32 & 64 bit versions?

    I already have an SCCM APPLICATION (using the MSI) created. Would I need to create an SCCM PACKAGE instead and have the Offscrub10.vbs run as a program before the 2013 install?

    Wednesday, July 20, 2016 8:35 AM

Answers

  • Yes it will remove it;

    You can use these switches:
    "OffScrub10.vbs" ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1

    Or:
    "OffScrub10.vbs" ALL /S /Q /NoCancel /Bypass 1

    You could deploy Office with a Powershell script and first let Offscrub run before the installation of the new version begins.
    You can use the PsAppDeployToolkit to acomplish this.
    This toolkit lets you even have an interactive installation with a built in reboot if required.

    For instance:
    1. You want to uninstall Office 2010 first
    2. Before beginning with the uninstall show a popup asking users to close and save open Office documents
    3. Allow user to defer the installation (or not)
    4. Reboot
    5. Continue installing new version

    All in one script.

    I use it for all my deployments.

    TIP:
    If you choose to use the toolkit for this, make sure to include the "IgnoreExitCodes" parameter in order to not confuse SCCM.
    Exaple: 
    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'


    Wednesday, July 20, 2016 11:21 AM
  • Hi,

    I would like to share these two great blog posts with you:

    How to uninstall Office 2010 and move to Office 2013 (Click to Run or Volume License) - https://blogs.technet.microsoft.com/odsupport/2014/11/03/how-to-uninstall-office-2010-and-move-to-office-2013-click-to-run-or-volume-license/

    How to obtain and use Offscrub to automate the uninstallation of Office products - https://blogs.technet.microsoft.com/odsupport/2011/04/08/how-to-obtain-and-use-offscrub-to-automate-the-uninstallation-of-office-products/

    These two posts contain some code snippets which should be helpful for you. You are right that you need to run Offscrub to remove Office 2010 prior to the installation of Office 2013. You can integrate these two processes into one script file, for example a VBS script, or a batch file, then deploy it via SCCM.

    The example batch file in this article should be helpful:

    https://blogs.technet.microsoft.com/odsupport/2011/04/06/how-to-perform-an-uninstall-upgrade-to-office-2010/

    Hope this helps.

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Thursday, July 21, 2016 7:17 AM
    Moderator
  • I have just finished and tested my own Office 365 ProPlus 2016 upgrade script (Click to run).
    Tested it and it works like a charm without any issues.

    We have PC's with Office 2007, 2010 and 2013 (Click to Run).
    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 and I give them the possibility to first save their work and close all programs.
    -> You can even let them postopne the installation a couple of times if you like.

    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:

    Folder Structure

    I've created a simple SCCM 2012 R2 Application:
    Installation program: Deploy-Application.exe -DeploymentType Install -DeployMode Interactive

    -> Here you have to change it to whatever suits your needs;
    If you don't want it to be interactive, make it:
    Deploy-Application.exe -DeploymentType Install -DeployMode Silent

    Here is my Deploy-Application.ps1 script.
    Hope it helps.

    <#
    .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 
    	http://psappdeploytoolkit.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
    )
    
    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.6965.2058'
    	[string]$appArch = 'x64'
    	[string]$appLang = 'EN'
    	[string]$appRevision = '01'
    	[string]$appScriptVersion = '1.2.1'
    	[string]$appScriptDate = '19/07/2016'
    	[string]$appScriptAuthor = 'Aldin T.'
    	##*===============================================
    	## Variables: Install Titles (Only set here to override defaults set by the toolkit)
    	[string]$installName = 'Office 365 ProPlus 2016'
    	[string]$installTitle = 'Office 365 ProPlus 2016'
    
    	##* 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'
    
            # 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"
    
    
            Show-InstallationPrompt `
                -Message "This will install Microsoft Office 365 ProPlus 2016 for you. Please note that the installation can take up to 45 minutes.`nAll previous Office versions will be uninstalled first.`nSave all your work and click OK to continue." `
                -ButtonRightText "OK" `
                -Icon Information `
                -Timeout 120 `
                -ExitOnTimeout $false
            
            Start-Sleep 5
    
            ## 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 'ose,osppsvc,sppsvc,msoia,excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio,iexplore' -CloseAppsCountdown 900 -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'
    
            #construct offscrub path
            $Offscrub03 = '"' + $dirSupportFiles + '\OffScrub03.vbs' + '"'
            $Offscrub07 = '"' + $dirSupportFiles + '\OffScrub07.vbs' + '"'
            $Offscrub10 = '"' + $dirSupportFiles + '\OffScrub10.vbs' + '"'
            $Offscrub15msi = '"' + $dirSupportFiles + '\OffScrub_O15msi.vbs' + '"'
            $Offscrubc2r = '"' + $dirSupportFiles + '\OffScrubc2r.vbs' + '"'
    
    
            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 "$Offscrub03 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 "$Offscrub07 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 "$Offscrub10 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 "$Offscrub15msi 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 "$Offscrubc2r 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 "$Offscrub10 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 "$Offscrub15msi 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 "$Offscrubc2r ALL /S /Q /NoCancel /Bypass 1" -WindowStyle Hidden -IgnoreExitCodes '1,2,3,42,34,67'
                Break
            }
            }
    		
    		
    		##*===============================================
    		##* INSTALLATION 
    		##*===============================================
    		[string]$installPhase = 'Installation'
    		
    		
    		Show-InstallationProgress -StatusMessage 'Installing Office 365 ProPlus 2016. This may take some time. Please wait…' -TopMost $True
            Execute-Process -Path "$dirFiles\Setup.exe" -Parameters "/configure configuration-Install.xml"
    		
    		
    		##*===============================================
    		##* POST-INSTALLATION
    		##*===============================================
    		[string]$installPhase = 'Post-Installation'
    
    		## Display a message at the end of the install
    		If (-not $useDefaultMsi) { Show-InstallationPrompt -Message "Office 365 ProPlus 2016 Installation is complete." -ButtonRightText 'OK' -Icon Information -NoWait }
    	}
    	ElseIf ($deploymentType -ieq 'Uninstall')
    	{
    		##*===============================================
    		##* PRE-UNINSTALLATION
    		##*===============================================
    		[string]$installPhase = 'Pre-Uninstallation'
    
            # 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"
    	
            ## 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
    		
    		
    		##*===============================================
    		##* 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>
            Show-InstallationProgress -StatusMessage 'Uninstalling Office 365 ProPlus. This may take some time. Please wait…'
            Execute-Process -Path "$dirFiles\Setup.exe" -Parameters "/configure configuration-Uninstall.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 = 60001
    	[string]$mainErrorMessage = "$(Resolve-Error)"
    	Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
    	Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
    	Exit-Script -ExitCode $mainExitCode
    }

    Tuesday, July 26, 2016 2:11 PM

All replies

  • Yes it will remove it;

    You can use these switches:
    "OffScrub10.vbs" ProPlus,Pro,Standard,SINGLEIMAGE /S /Q /NoCancel /Bypass 1

    Or:
    "OffScrub10.vbs" ALL /S /Q /NoCancel /Bypass 1

    You could deploy Office with a Powershell script and first let Offscrub run before the installation of the new version begins.
    You can use the PsAppDeployToolkit to acomplish this.
    This toolkit lets you even have an interactive installation with a built in reboot if required.

    For instance:
    1. You want to uninstall Office 2010 first
    2. Before beginning with the uninstall show a popup asking users to close and save open Office documents
    3. Allow user to defer the installation (or not)
    4. Reboot
    5. Continue installing new version

    All in one script.

    I use it for all my deployments.

    TIP:
    If you choose to use the toolkit for this, make sure to include the "IgnoreExitCodes" parameter in order to not confuse SCCM.
    Exaple: 
    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'


    Wednesday, July 20, 2016 11:21 AM

  • 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'


    sounds promising...I've tried to run PSADT but ran into errors:

    2016/07/20 11:18:06:252::[7864] Installation of 32-bit Office product blocked as supported 64-bit Office product already installed.
    2016/07/20 11:18:06:252::[7864] The following are a list of the 64-bit Office product(s) installed :
    2016/07/20 11:18:06:252::[7864] Microsoft Office Office 32-bit Components 2010
    2016/07/20 11:18:06:252::[7864] Microsoft Office Professional Plus 2010
    2016/07/20 11:18:06:252::[7864] See Setup.chm for more information.


    The ps1 only ignores the exit codes 1, 2, 3 ...could that fix this issue?

    i did look at running the OffScrub10.vbs as part of the 'Add installations and run programs' section in the OCT, but i'm not sure if that's possible.

    below is the exit code i get ..even after ignoring exit codes '1,2,3,16,42'

    Wednesday, July 20, 2016 11:56 AM
  • The error shows that you are trying to run a setup of 32 bit Office whereas on the same machine is a 64 bit version of office installed.
    You cannot have both bit version on one machine.

    You can check if ose64 or ose service is running:
    Check of x64 bit of  Office instaled: Get-Service -Name ose64
    Check of 32 bit of  Office instaled: Get-Service -Name ose

    Also, in the PSADT you should open the help file to find more useful cmdlets and functions with some examples.

    How I test my scripts is:
    Open Powershell ISE (run as admin)
    Open Deploy-Application.ps1 and add my code for install/uninstall.
    In same window open AppDeployToolkit\AppDeployToolkitMain.ps1 and run it.

    This will load all functions so you can test them.


    What you can do is in the pre-installation part add the uninstall of Office 2010 code;
    At the end of that part, add Show-InstallationRestartPrompt to restart computer before continuing.
    In the Installation part you add the setup of new Office.

    Wednesday, July 20, 2016 12:45 PM
  • I was browsing the PsAppDeployToolkit forums and saw that someone already created an Office install script.

    With some adjustments you'll have your own script:
    http://psappdeploytoolkit.com/forums/topic/office-365-2016-click-to-run/

    Wednesday, July 20, 2016 1:49 PM
  • at the risk of sound ridiculously stupid...how do i do that?

    My understanding is its supposed to run the OffScrub10.vbs before even attempting to install 2013.

    (the entire script was taken from the examples folder)

     
    Wednesday, July 20, 2016 2:05 PM
  • Hi,

    I would like to share these two great blog posts with you:

    How to uninstall Office 2010 and move to Office 2013 (Click to Run or Volume License) - https://blogs.technet.microsoft.com/odsupport/2014/11/03/how-to-uninstall-office-2010-and-move-to-office-2013-click-to-run-or-volume-license/

    How to obtain and use Offscrub to automate the uninstallation of Office products - https://blogs.technet.microsoft.com/odsupport/2011/04/08/how-to-obtain-and-use-offscrub-to-automate-the-uninstallation-of-office-products/

    These two posts contain some code snippets which should be helpful for you. You are right that you need to run Offscrub to remove Office 2010 prior to the installation of Office 2013. You can integrate these two processes into one script file, for example a VBS script, or a batch file, then deploy it via SCCM.

    The example batch file in this article should be helpful:

    https://blogs.technet.microsoft.com/odsupport/2011/04/06/how-to-perform-an-uninstall-upgrade-to-office-2010/

    Hope this helps.

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Thursday, July 21, 2016 7:17 AM
    Moderator
  • I have just finished and tested my own Office 365 ProPlus 2016 upgrade script (Click to run).
    Tested it and it works like a charm without any issues.

    We have PC's with Office 2007, 2010 and 2013 (Click to Run).
    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 and I give them the possibility to first save their work and close all programs.
    -> You can even let them postopne the installation a couple of times if you like.

    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:

    Folder Structure

    I've created a simple SCCM 2012 R2 Application:
    Installation program: Deploy-Application.exe -DeploymentType Install -DeployMode Interactive

    -> Here you have to change it to whatever suits your needs;
    If you don't want it to be interactive, make it:
    Deploy-Application.exe -DeploymentType Install -DeployMode Silent

    Here is my Deploy-Application.ps1 script.
    Hope it helps.

    <#
    .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 
    	http://psappdeploytoolkit.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
    )
    
    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.6965.2058'
    	[string]$appArch = 'x64'
    	[string]$appLang = 'EN'
    	[string]$appRevision = '01'
    	[string]$appScriptVersion = '1.2.1'
    	[string]$appScriptDate = '19/07/2016'
    	[string]$appScriptAuthor = 'Aldin T.'
    	##*===============================================
    	## Variables: Install Titles (Only set here to override defaults set by the toolkit)
    	[string]$installName = 'Office 365 ProPlus 2016'
    	[string]$installTitle = 'Office 365 ProPlus 2016'
    
    	##* 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'
    
            # 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"
    
    
            Show-InstallationPrompt `
                -Message "This will install Microsoft Office 365 ProPlus 2016 for you. Please note that the installation can take up to 45 minutes.`nAll previous Office versions will be uninstalled first.`nSave all your work and click OK to continue." `
                -ButtonRightText "OK" `
                -Icon Information `
                -Timeout 120 `
                -ExitOnTimeout $false
            
            Start-Sleep 5
    
            ## 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 'ose,osppsvc,sppsvc,msoia,excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio,iexplore' -CloseAppsCountdown 900 -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'
    
            #construct offscrub path
            $Offscrub03 = '"' + $dirSupportFiles + '\OffScrub03.vbs' + '"'
            $Offscrub07 = '"' + $dirSupportFiles + '\OffScrub07.vbs' + '"'
            $Offscrub10 = '"' + $dirSupportFiles + '\OffScrub10.vbs' + '"'
            $Offscrub15msi = '"' + $dirSupportFiles + '\OffScrub_O15msi.vbs' + '"'
            $Offscrubc2r = '"' + $dirSupportFiles + '\OffScrubc2r.vbs' + '"'
    
    
            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 "$Offscrub03 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 "$Offscrub07 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 "$Offscrub10 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 "$Offscrub15msi 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 "$Offscrubc2r 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 "$Offscrub10 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 "$Offscrub15msi 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 "$Offscrubc2r ALL /S /Q /NoCancel /Bypass 1" -WindowStyle Hidden -IgnoreExitCodes '1,2,3,42,34,67'
                Break
            }
            }
    		
    		
    		##*===============================================
    		##* INSTALLATION 
    		##*===============================================
    		[string]$installPhase = 'Installation'
    		
    		
    		Show-InstallationProgress -StatusMessage 'Installing Office 365 ProPlus 2016. This may take some time. Please wait…' -TopMost $True
            Execute-Process -Path "$dirFiles\Setup.exe" -Parameters "/configure configuration-Install.xml"
    		
    		
    		##*===============================================
    		##* POST-INSTALLATION
    		##*===============================================
    		[string]$installPhase = 'Post-Installation'
    
    		## Display a message at the end of the install
    		If (-not $useDefaultMsi) { Show-InstallationPrompt -Message "Office 365 ProPlus 2016 Installation is complete." -ButtonRightText 'OK' -Icon Information -NoWait }
    	}
    	ElseIf ($deploymentType -ieq 'Uninstall')
    	{
    		##*===============================================
    		##* PRE-UNINSTALLATION
    		##*===============================================
    		[string]$installPhase = 'Pre-Uninstallation'
    
            # 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"
    	
            ## 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
    		
    		
    		##*===============================================
    		##* 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>
            Show-InstallationProgress -StatusMessage 'Uninstalling Office 365 ProPlus. This may take some time. Please wait…'
            Execute-Process -Path "$dirFiles\Setup.exe" -Parameters "/configure configuration-Uninstall.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 = 60001
    	[string]$mainErrorMessage = "$(Resolve-Error)"
    	Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
    	Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
    	Exit-Script -ExitCode $mainExitCode
    }

    Tuesday, July 26, 2016 2:11 PM
  • Thanks for sharing this AITu85.

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Friday, July 29, 2016 2:30 AM
    Moderator
  • This is an older post, however i would like to ask a question.

    I am running a script and cleanup is done and 360 is installed.

    Script complete and exited, but the GUI is still showing.

    How can i close it?

    Thank you,

    Friday, April 07, 2017 4:44 PM