Repository navigation
Operational Modes
Relevant source files
The following files were used as context for generating this wiki page:
This document describes the operational modes supported by OfficeScrubC2R, the high-performance Office Click-to-Run removal tool. It explains how different command-line parameters and flags control the tool's behavior, including interactive, silent, detection-only, offline, force, and unpin-only modes. The focus is on how these modes are implemented, their effects on execution flow, and how to select the appropriate mode for a given scenario.
For a detailed reference of all command-line parameters, see Command-Line Parameters. For practical usage scenarios and examples, see Use Cases and Examples.
This page covers:
- The available operational modes of OfficeScrubC2R.
- How each mode alters the script's execution flow.
- The mapping between user-facing options and internal code logic.
- Diagrams connecting natural language descriptions to code entities.
This page does not cover parameter syntax details (see 5.1), troubleshooting (see 5.4), or developer-oriented implementation details (see 6).
OfficeScrubC2R supports several distinct operational modes, each controlled by one or more command-line parameters. The main modes are:
| Mode Name | Key Parameter(s) | Description |
|---|---|---|
| Interactive | (default) | Prompts user for confirmation before removal; outputs progress and summary. |
| Silent |
-Quiet, -Force
|
Suppresses prompts and most output; proceeds without user interaction. |
| Detection-Only | -DetectOnly |
Scans and reports installed Office products; does not perform removal or cleanup actions. |
| Offline | -Offline |
Skips download of Office Deployment Tool (ODT); uses only local resources. |
| Force | -Force |
Skips confirmation prompts; used with or without -Quiet for unattended operation. |
| Unpin-Only | -UnpinMode |
Only unpins Office shortcuts from taskbar/start menu; skips removal and cleanup. |
Sources:
Title: "Operational Modes to Code Entities Mapping"
flowchart TD
"UserInput"["User Input (CLI Parameters)"]
"MainFunction"["Main()"]
"InitializeScript"["Initialize-Script"]
"FindInstalledOfficeProducts"["Find-InstalledOfficeProducts"]
"UninstallOfficeProducts"["Uninstall-OfficeProducts"]
"CleanOfficeRegistry"["Clean-OfficeRegistry"]
"CompleteCleanup"["Complete-Cleanup"]
"ShowSummary"["Show-Summary"]
"UserInput" -->|"(-Quiet)"| "InitializeScript"
"UserInput" -->|"(-Force)"| "InitializeScript"
"UserInput" -->|"(-DetectOnly)"| "InitializeScript"
"UserInput" -->|"(-Offline)"| "InitializeScript"
"UserInput" -->|"(-UnpinMode)"| "InitializeScript"
"InitializeScript" --> "MainFunction"
"MainFunction" --> "FindInstalledOfficeProducts"
"MainFunction" -->|"if -DetectOnly"| "ShowSummary"
"MainFunction" -->|"if not -DetectOnly"| "UninstallOfficeProducts"
"UninstallOfficeProducts" --> "CleanOfficeRegistry"
"CleanOfficeRegistry" --> "CompleteCleanup"
"CompleteCleanup" --> "ShowSummary"
Sources:
Description:
This is the default mode when neither -Quiet nor -Force is specified. The script prompts the user for confirmation before proceeding with removal. Progress and summary information are displayed interactively.
Key Behaviors:
- Prompts:
- Asks for confirmation before uninstalling Office products (OfficeScrubC2R.ps1:953-961).
- Output:
- Logs and progress messages are shown in the console.
- User can cancel the operation at the confirmation prompt.
Relevant Code:
- Confirmation prompt:
OfficeScrubC2R.ps1:952-961
if (-not $script:Force -and -not $script:Quiet) { $confirmation = Read-Host ("Are you sure you want to remove all Office C2R products? (Y/N)") if ($confirmation -notmatch "^[Yy]") { Write-Log ("User cancelled removal") Set-ErrorCode $script:ERROR_USERCANCEL Show-Summary return $script:ERROR_USERCANCEL } }
Sources:
Description:
Silent mode is activated by specifying -Quiet and typically also -Force. In this mode, the script suppresses all user prompts and minimizes output, making it suitable for automated or unattended scenarios.
Key Behaviors:
- No confirmation prompts; removal proceeds automatically.
- Minimal output to the console.
- If a reboot is required, the script does not prompt the user interactively (unless
-Quietis omitted).
Relevant Code:
- Parameter handling:
OfficeScrubC2R.ps1:63, 65, 90-92, 952-961, 908-914 - Example usage:
Invoke-OfficeScrubC2R -Quiet -Force(README.md:69, 88)
Table: Silent Mode Effects
| Parameter | Effect on Script Behavior |
|---|---|
-Quiet |
Suppresses most output and prompts |
-Force |
Skips confirmation, proceeds directly |
Sources:
Description:
Detection-only mode is enabled with the -DetectOnly parameter. The script scans for installed Office products and reports findings, but does not perform any removal or cleanup actions.
Key Behaviors:
- No changes are made to the system.
- Only detection logic is executed.
- A summary of detected products is displayed or logged.
Relevant Code:
- Parameter:
OfficeScrubC2R.ps1:64, 91 - Detection logic:
OfficeScrubC2R.ps1:940-950 - Example usage:
Invoke-OfficeScrubC2R -DetectOnly(README.md:71, 85)
Diagram: Detection-Only Mode Execution Path
stateDiagram-v2
[*] --> "Main()"
"Main()" --> "Initialize-Script"
"Initialize-Script" --> "Find-InstalledOfficeProducts"
"Find-InstalledOfficeProducts" --> "Show-Summary": "if -DetectOnly"
"Show-Summary" --> [*]
Sources:
Description:
Offline mode is activated with the -Offline parameter. In this mode, the script does not attempt to download the Office Deployment Tool (ODT) and relies solely on local resources for uninstallation.
Key Behaviors:
- Skips ODT download step (OfficeScrubC2R.ps1:68, 95, 260-280).
- Useful in environments without internet access.
Relevant Code:
- Parameter:
OfficeScrubC2R.ps1:68, 95 - ODT download logic:
OfficeScrubC2R.ps1:260-280 - Example usage:
Invoke-OfficeScrubC2R -Offline -Force(README.md:94)
Sources:
Description:
The -Force parameter causes the script to skip all confirmation prompts and proceed directly with removal. It is often used in combination with -Quiet for fully unattended operation.
Key Behaviors:
- No user confirmation is requested.
- Removal proceeds immediately after detection.
Relevant Code:
- Parameter:
OfficeScrubC2R.ps1:65, 92, 952-961 - Example usage:
Invoke-OfficeScrubC2R -Force(README.md:69, 88)
Sources:
Description:
When the -UnpinMode parameter is specified, the script only unpins Office shortcuts from the taskbar and/or start menu, without performing product removal or registry/file cleanup.
Key Behaviors:
- Only shortcut unpinning logic is executed.
- No uninstall or cleanup actions are performed.
Relevant Code:
- Parameter:
OfficeScrubC2R.ps1:71, 98 - Example usage:
Invoke-OfficeScrubC2R -UnpinMode -SkipSD(README.md:90)
Sources:
Title: "Operational Mode Decision Flow in Main()"
flowchart TD
"Start"["Start"]
"InitializeScript"["Initialize-Script"]
"FindInstalledOfficeProducts"["Find-InstalledOfficeProducts"]
"DetectOnlyCheck"["if -DetectOnly"]
"ForceQuietCheck"["if -Force or -Quiet"]
"UserPrompt"["Prompt for confirmation"]
"UserCancel"["User cancels"]
"UninstallOfficeProducts"["Uninstall-OfficeProducts"]
"CleanOfficeRegistry"["Clean-OfficeRegistry"]
"CompleteCleanup"["Complete-Cleanup"]
"ShowSummary"["Show-Summary"]
"End"["End"]
"Start" --> "InitializeScript"
"InitializeScript" --> "FindInstalledOfficeProducts"
"FindInstalledOfficeProducts" --> "DetectOnlyCheck"
"DetectOnlyCheck" -- "Yes" --> "ShowSummary"
"DetectOnlyCheck" -- "No" --> "ForceQuietCheck"
"ForceQuietCheck" -- "Yes" --> "UninstallOfficeProducts"
"ForceQuietCheck" -- "No" --> "UserPrompt"
"UserPrompt" -- "User confirms" --> "UninstallOfficeProducts"
"UserPrompt" -- "User cancels" --> "UserCancel"
"UserCancel" --> "ShowSummary"
"UninstallOfficeProducts" --> "CleanOfficeRegistry"
"CleanOfficeRegistry" --> "CompleteCleanup"
"CompleteCleanup" --> "ShowSummary"
"ShowSummary" --> "End"
Sources:
| Mode | Key Parameter(s) | User Prompt | Output Level | Removal Actions | ODT Download | Shortcut Unpin | Use Case Example |
|---|---|---|---|---|---|---|---|
| Interactive | (default) | Yes | Verbose | Yes | Yes | Yes | Manual cleanup |
| Silent | -Quiet, -Force | No | Minimal | Yes | Yes/No | Yes | Automated deployment |
| Detection-Only | -DetectOnly | No | Verbose | No | No | No | Audit/assessment |
| Offline | -Offline | No/Yes | Any | Yes | No | Yes | No internet access |
| Force | -Force | No | Any | Yes | Yes/No | Yes | Unattended removal |
| Unpin-Only | -UnpinMode | No | Minimal | No | No | Yes | Remove taskbar/start menu pins |
Sources:
- Modes can be combined (e.g.,
-Quiet -Force -Offline). - Some parameters (e.g.,
-KeepLicense,-RemoveAll) further refine behavior within these modes. - For a full list of parameters and their descriptions, see Command-Line Parameters.
End of document.