Compare commits

..

No commits in common. "main" and "v1" have entirely different histories.
main ... v1

5 changed files with 84 additions and 77 deletions

View File

@ -24,9 +24,10 @@
.OUTPUTS .OUTPUTS
Just output on screen Just output on screen
.NOTES .NOTES
Version: 1.3 Version: 1.0
Author: Heko Büroservice GmbH & Co. KG. Author: aaron.viehl@frankfurt.einsnulleins.de
Creation Date: 2025-01-28 Creation Date: 2022-02-04
Purpose/Change: Initial script development
.EXAMPLE .EXAMPLE
.\msoffice-removal-tool.ps1 -InstallOffice365 -SupressReboot .\msoffice-removal-tool.ps1 -InstallOffice365 -SupressReboot
#> #>
@ -45,7 +46,7 @@ $SaRA_URL = "https://aka.ms/SaRA_CommandLineVersionFiles"
$SaRA_ZIP = "$env:TEMP\SaRA.zip" $SaRA_ZIP = "$env:TEMP\SaRA.zip"
$SaRA_DIR = "$env:TEMP\SaRA" $SaRA_DIR = "$env:TEMP\SaRA"
$SaRA_EXE = "$SaRA_DIR\SaRAcmd.exe" $SaRA_EXE = "$SaRA_DIR\SaRAcmd.exe"
$Office365Setup_URL = "https://git.heko-technik.de/mkrieger/msoffice-removal-tool/raw/branch/main/office365-installer" $Office365Setup_URL = "https://github.com/Admonstrator/msoffice-removal-tool/raw/main/office365-installer"
#-----------------------------------------------------------[Functions]------------------------------------------------------------ #-----------------------------------------------------------[Functions]------------------------------------------------------------
Function Invoke-OfficeUninstall { Function Invoke-OfficeUninstall {
if (-Not (Test-Path "$SaRA_DIR")) { if (-Not (Test-Path "$SaRA_DIR")) {
@ -108,7 +109,7 @@ Function Stop-OfficeProcess {
} }
Function Invoke-SaRA { Function Invoke-SaRA {
$SaRAProcess = Start-Process -FilePath "$SaRA_EXE" -ArgumentList "-S OfficeScrubScenario -AcceptEula -CloseOffice -OfficeVersion All" -Wait -PassThru -NoNewWindow $SaRAProcess = Start-Process -FilePath "$SaRA_EXE" -ArgumentList "-S OfficeScrubScenario -AcceptEula" -Wait -PassThru -NoNewWindow
switch ($SaRAProcess.ExitCode) { switch ($SaRAProcess.ExitCode) {
0 { 0 {
Write-Host "Uninstall successful!" Write-Host "Uninstall successful!"
@ -137,14 +138,6 @@ Function Invoke-SaRA {
} }
Function Invoke-SetupOffice365($Office365ConfigFile) { Function Invoke-SetupOffice365($Office365ConfigFile) {
if ($Office365ConfigFile -eq "$Office365Setup_URL/purge.xml") {
Write-Host "Downloading Office365 Installer ..."
Start-BitsTransfer -Source "$Office365Setup_URL/setup.exe" -Destination "$SaRA_DIR\setup.exe"
Start-BitsTransfer -Source "$Office365ConfigFile" -Destination "$SaRA_DIR\purge.xml"
Write-Host "Executing Office365 Setup ..."
$OfficeSetup = Start-Process -FilePath "$SaRA_DIR\setup.exe" -ArgumentList "/configure $SaRA_DIR\purge.xml" -Wait -PassThru -NoNewWindow
}
if ($InstallOffice365) { if ($InstallOffice365) {
Write-Host "Downloading Office365 Installer ..." Write-Host "Downloading Office365 Installer ..."
Start-BitsTransfer -Source "$Office365Setup_URL/setup.exe" -Destination "$SaRA_DIR\setup.exe" Start-BitsTransfer -Source "$Office365Setup_URL/setup.exe" -Destination "$SaRA_DIR\setup.exe"
@ -174,24 +167,22 @@ Function Invoke-RebootInSeconds($Seconds) {
} }
Function Set-CurrentStage($StageValue) { Function Set-CurrentStage($StageValue) {
if (-not (Test-Path "HKLM:\Software\OEM\Heko-Bueroservice-GmbH\M365\Install")) { if (-not (Test-Path "HKLM:\Software\OEM\101\M365\Install")) {
New-Item -Path "HKLM:\Software\OEM\Heko-Bueroservice-GmbH\M365\Install" -Force | Out-Null New-Item -Path "HKLM:\Software\OEM\101\M365\Install" -Force | Out-Null
} }
New-ItemProperty -Path "HKLM:\Software\OEM\Heko-Bueroservice-GmbH\M365\Install" -Name "CurrentStage" -Value $StageValue -PropertyType String -Force | Out-Null New-ItemProperty -Path "HKLM:\Software\OEM\101\M365\Install" -Name "CurrentStage" -Value $StageValue -PropertyType String -Force | Out-Null
} }
Function Invoke-Intro { Function Invoke-Intro {
Write-Host " _ _ _ ______ _ _ _ " Write-Host " ___ ___ ___ _____ _____ _____ "
Write-Host "| | | | | | | ___ (_) (_) (_) " Write-Host "|_ | | |_ | | __| __| |"
Write-Host "| |_| | ___| | _____ | |_/ /_ _ _ __ ___ ___ ___ _ ____ ___ ___ ___ " Write-Host " _| |_| | |_| |_ | __| __| | | |"
Write-Host "| _ |/ _ \ |/ / _ \ | ___ \ | | | '__/ _ \/ __|/ _ \ '__\ \ / / |/ __/ _ \" Write-Host "|_____|___|_____| |__| |__| |_|_|_|"
Write-Host "| | | | __/ < (_) | | |_/ / |_| | | | (_) \__ \ __/ | \ V /| | (_| __/" Write-Host ""
Write-Host "\_| |_/\___|_|\_\___/ \____/ \__,_|_| \___/|___/\___|_| \_/ |_|\___\___|" Write-Host "Microsoft Office Removal Tool"
Write-Host "" Write-Host "by Aaron Viehl (101 Frankfurt)"
Write-Host "Microsoft Office Removal Tool" Write-Host "einsnulleins.de"
Write-Host "by Max Krieger" Write-Host ""
Write-Host "heko-bs.de"
Write-Host ""
} }
#-----------------------------------------------------------[Execution]------------------------------------------------------------ #-----------------------------------------------------------[Execution]------------------------------------------------------------
@ -206,11 +197,10 @@ if (-Not $Force) {
} }
} }
Invoke-Intro
# Check if there is a stage to resume # Check if there is a stage to resume
if (-not ($RunAgain)) { if (-not ($RunAgain)) {
if (Test-Path "HKLM:\Software\OEM\Heko-Bueroservice-GmbH\M365\Install") { if (Test-Path "HKLM:\Software\OEM\101\M365\Install") {
$CurrentStageValue = (Get-ItemProperty "HKLM:\Software\OEM\Heko-Bueroservice-GmbH\M365\Install").CurrentStage $CurrentStageValue = (Get-ItemProperty "HKLM:\Software\OEM\101\M365\Install").CurrentStage
Switch ($CurrentStageValue) { Switch ($CurrentStageValue) {
1 { 1 {
Write-Host "Resuming Stage 1: Uninstalling Office ..." Write-Host "Resuming Stage 1: Uninstalling Office ..."

View File

@ -1,19 +1,30 @@
<Configuration ID="7d07fe48-5cff-42e4-90e7-f09d3d20c732"> <Configuration ID="A9B3AC9B-7436-4348-AFD5-8769F4D06A4A" >
<Info Description="" /> <Add>
<Add OfficeClientEdition="64" Channel="Current"> <Product ID="O365ProPlusRetail">
<Product ID="O365BusinessEEANoTeamsRetail"> <Language ID="MatchOS"/>
<Language ID="de-de" /> <Language ID="MatchPreviousMSI"/>
<ExcludeApp ID="Groove" /> <ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync" /> <ExcludeApp ID="Lync" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="Access" />
</Product>
<Product ID="VisioProRetail" MSICondition="VisPro,VisProR">
<Language ID="MatchOS"/>
<Language ID="MatchPreviousMSI"/>
<ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="Access" />
</Product>
<Product ID="ProjectProRetail" MSICondition="PrjPro,PrjProR">
<Language ID="MatchOS"/>
<Language ID="MatchPreviousMSI"/>
<ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="Access" />
</Product> </Product>
</Add> </Add>
<Updates Enabled="TRUE" /> <Remove All="TRUE" />
<RemoveMSI /> <RemoveMSI />
<AppSettings>
<Setup Name="Company" Value="Heko Bueroservice GmbH &amp; Co. KG." />
<User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="51" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" />
<User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="27" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" />
<User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" />
</AppSettings>
<Display Level="Full" AcceptEULA="TRUE" />
</Configuration> </Configuration>

Binary file not shown.

View File

@ -1,19 +1,28 @@
<Configuration ID="7d07fe48-5cff-42e4-90e7-f09d3d20c732"> <Configuration ID="A9B3AC9B-7436-4348-AFD5-8769F4D06A4A" >
<Info Description="" /> <Add>
<Add OfficeClientEdition="64" Channel="Current"> <Product ID="O365ProPlusRetail">
<Product ID="O365BusinessEEANoTeamsRetail"> <Language ID="MatchOS"/>
<Language ID="de-de" /> <Language ID="MatchPreviousMSI"/>
<ExcludeApp ID="Groove" /> <ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync" /> <ExcludeApp ID="Lync" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="Access" />
</Product>
<Product ID="VisioProRetail" MSICondition="VisPro,VisProR">
<Language ID="MatchOS"/>
<Language ID="MatchPreviousMSI"/>
<ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="Access" />
</Product>
<Product ID="ProjectProRetail" MSICondition="PrjPro,PrjProR">
<Language ID="MatchOS"/>
<Language ID="MatchPreviousMSI"/>
<ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="Access" />
</Product> </Product>
</Add> </Add>
<Updates Enabled="TRUE" />
<RemoveMSI />
<AppSettings>
<Setup Name="Company" Value="Heko Bueroservice GmbH &amp; Co. KG." />
<User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="51" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" />
<User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="27" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" />
<User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" />
</AppSettings>
<Display Level="Full" AcceptEULA="TRUE" />
</Configuration> </Configuration>

View File

@ -1,17 +1,14 @@
# Microsoft Office Removal Tool # Microsoft Office Removal Tool
```plain ```plain
___ ___ ___ _____ _____ _____
_ _ _ ______ _ _ _ |_ | | |_ | | __| __| |
| | | | | | | ___ (_) (_) (_) _| |_| | |_| |_ | __| __| | | |
| |_| | ___| | _____ | |_/ /_ _ _ __ ___ ___ ___ _ ____ ___ ___ ___ |_____|___|_____| |__| |__| |_|_|_|
| _ |/ _ \ |/ / _ \ | ___ \ | | | '__/ _ \/ __|/ _ \ '__\ \ / / |/ __/ _ \
| | | | __/ < (_) | | |_/ / |_| | | | (_) \__ \ __/ | \ V /| | (_| __/
\_| |_/\___|_|\_\___/ \____/ \__,_|_| \___/|___/\___|_| \_/ |_|\___\___|
Microsoft Office Removal Tool Microsoft Office Removal Tool
by Max Krieger by Aaron Viehl (101 Frankfurt)
heko-bs.de einsnulleins.de
``` ```
## Synopsis ## Synopsis
@ -41,7 +38,7 @@ By using `-UseSetupRemoval` the Office365 setup method will be used.
## Stage mechanism ## Stage mechanism
To make sure that the program will only do the necessary parts a _stage mechanism_ is builtin. After every stage a registry value will be written to ``HKLM:\Software\OEM\Heko-Bueroservice-GmbH\M365\Install\CurrentStage`` To make sure that the program will only do the necessary parts a _stage mechanism_ is builtin. After every stage a registry value will be written to ``HKLM:\Software\OEM\101\M365\Install\CurrentStage``
To overwrite all stages and restart the whole script use ``-RunAgain``. To overwrite all stages and restart the whole script use ``-RunAgain``.
@ -50,5 +47,5 @@ To overwrite all stages and restart the whole script use ``-RunAgain``.
You may use this script without explicit download: You may use this script without explicit download:
```powershell ```powershell
iwr https://git.heko-technik.de/mkrieger/msoffice-removal-tool/raw/branch/main/msoffice-removal-tool.ps1 -OutFile msoffice-removal-tool.ps1; powershell -ExecutionPolicy Bypass .\msoffice-removal-tool.ps1 iwr https://raw.githubusercontent.com/Admonstrator/msoffice-removal-tool/main/msoffice-removal-tool.ps1 -OutFile msoffice-removal-tool.ps1; powershell -ExecutionPolicy Bypass .\msoffice-removal-tool.ps1
``` ```