GPO — Usuwanie poprzednich wersji Office

📋 Group Policy POWERSHELL ChrisTitusTech

Skrypt GPO automatycznie usuwający poprzednie wersje pakietu Office przy wdrożeniu nowej instalacji. Czyści pozostałości po starszych wersjach przed instalacją Office przez ODT.

Pobierz .ps1
📄 GPO-RemovePreviousOfficeInstalls.ps1 🕒 2026-04-13 📦 Źródło: christitustech
GPO-RemovePreviousOfficeInstalls.ps1
param(
 [Parameter()]
 [string]$OfficeDeploymentPath
)

Begin {
 Set-Location $OfficeDeploymentPath
}

Process {
 $scriptPath = "."

 # Importing required functions
 . $scriptPath\Generate-ODTConfigurationXML.ps1
 . $scriptPath\Edit-OfficeConfigurationFile.ps1
 . $scriptPath\SharedFunctions.ps1
 . $scriptPath\Remove-PreviousOfficeInstalls.ps1
  
 #--------------------------------------------------------------------------------------
 #   Customize the parameters - Modify the variables below to customize this script
 #--------------------------------------------------------------------------------------

 # Available list of ProductsToRemove:  AllOfficeProducts,MainOfficeProduct,Visio,Project
 [string[]]$ProductsToRemove = "AllOfficeProducts"
 
 [bool]$RemoveClickToRunVersions = $false
 
 [bool]$Remove2016Installs = $false
 
 [bool]$Force = $false
 
 [bool]$KeepUserSettings = $true
 
 [bool]$KeepLync = $false

 [bool]$NoReboot = $false

 [string]$LogFilePath = "$env:TEMP\RemovePreviousOfficeInstall.log"

 #-------------------------------------------------------------------------------------

 # Remove the products
 Remove-PreviousOfficeInstalls -ProductsToRemove $ProductsToRemove -RemoveClickToRunVersions $RemoveClickToRunVersions -Remove2016Installs $Remove2016Installs -Force $Force -KeepUserSettings $KeepUserSettings -KeepLync $KeepLync -NoReboot $NoReboot -LogFilePath $LogFilePath

}