Removal of office viewers,previous versions of office, and install office

this was made using PADT version 3.1.0
might need some updating. But it will get you started

Param (
[ValidateSet(“Install”,“Uninstall”)]
[string] $DeploymentType = “Install”,
[ValidateSet(“Interactive”,“Silent”,“NonInteractive”)]
[string] $DeployMode = “Interactive”,
[switch] $AllowRebootPassThru = $false,
[switch] $TerminalServerMode = $false
)

#===============================================
#
VARIABLE DECLARATION
Try {
#*===============================================

#*===============================================

Variables: Application

$appVendor = “Microsoft”
$appName = “Remove Viewers Add Office 2010”
$appVersion = “”
$appArch = “”
$appLang = “”
$appRevision = “01”
$appScriptVersion = “1.0.0”
$appScriptDate = “03/28/2014”
$appScriptAuthor = “”

#*===============================================

Variables: Script - Do not modify this section

$deployAppScriptFriendlyName = “Deploy Application”
$deployAppScriptVersion = [version]“3.1.0”
$deployAppScriptDate = “02/25/2013”
$deployAppScriptParameters = $psBoundParameters

Variables: Environment

$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition

Dot source the App Deploy Toolkit Functions

."$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"

#===============================================
#
END VARIABLE DECLARATION
#*===============================================

#===============================================
#
PRE-INSTALLATION
If ($deploymentType -ne “uninstall”) { $installPhase = “Pre-Installation”
#*===============================================

Perform pre-installation tasks here

Execute-Process -FilePath “msiexec.Exe” -Arguments “/X{95120000-003F-0409-0000-0000000FF1CE} /qn REBOOT=ReallySuppress” -ContinueOnError $true
Execute-Process -FilePath “msiexec.Exe” -Arguments “/X{90850409-6000-11D3-8CFE-0150048383C9} /qn REBOOT=ReallySuppress” -ContinueOnError $true
Execute-Process -FilePath “msiexec.Exe” -Arguments “/X{95140000-00AF-0409-0000-0000000FF1CE} /qn REBOOT=ReallySuppress” -ContinueOnError $true
Execute-Process -FilePath “msiexec.Exe” -Arguments “/X{90120000-0020-0409-0000-0000000FF1CE} /qn REBOOT=ReallySuppress” -ContinueOnError $true

Execute-Process -FilePath “CScript.Exe” -Arguments “”$dirSupportFiles\OffScrub10.vbs" STANDARD,Proplus /S /Q /NoCancel" -WindowStyle Hidden -IgnoreExitCodes “1,2,3”
Execute-Process -FilePath “CScript.Exe” -Arguments “”$dirSupportFiles\OffScrub07.vbs" STANDARD,Proplus /S /Q /NoCancel" -WindowStyle Hidden -IgnoreExitCodes “1,2,3”
Execute-Process -FilePath “CScript.Exe” -Arguments “”$dirSupportFiles\OffScrub03.vbs" STANDARD,Proplus /S /Q /NoCancel" -WindowStyle Hidden -IgnoreExitCodes “1,2,3”

#===============================================
#
INSTALLATION
$installPhase = “Installation”
#*===============================================

Perform installation tasks here

execute-process -FilePath “setup.exe” -Arguments “/adminfile yourownMSP.msp”

#===============================================
#
POST-INSTALLATION
$installPhase = “Post-Installation”
#*===============================================

Perform post-installation tasks here

Display a message at the end of the install

#Show-InstallationPrompt -Message “You can customise text to appear at the end of an install, or remove it completely for unattended installations.” -ButtonRightText “Ok” -Icon Information -NoWait

#===============================================
#
UNINSTALLATION
} ElseIf ($deploymentType -eq “uninstall”) { $installPhase = “Uninstallation”
#*===============================================

execute-process -FilePath “setup.exe” -Arguments “/uninstall PROPLUS”

#===============================================
#
END SCRIPT BODY
} } Catch { $exceptionMessage = “$($.Exception.Message) ($($.ScriptStackTrace))”; Write-Log “$exceptionMessage”; Show-DialogBox -Text $exceptionMessage -Icon “Stop”; Exit-Script -ExitCode 1 } # Catch any errors in this script
Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations
#*===============================================

I´m having problems with Office click-to-run and also office 2016 if its installed. Do you have any idea how I can add it to your script ?

I’m sure if you look up officescrub script for 2016 you’ll find one and just add it to a Execute-Process -FilePath “CScript.Exe” -Arguments “"$dirSupportFiles\ line

first of all awesome script! but is there a way to use this via GPO instead of SCCM ?

I would think it’s possible. You would just have to have a batch file or VB script to call the uninstallers from a UNC path.