Skip to content

Operational Modes

Calvindd2f edited this page Jan 14, 2026 · 1 revision

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.


Purpose and Scope

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).


Overview of Operational Modes

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:


Diagram: Mapping Operational Modes to Parameters and Functions

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"
Loading

Sources:


1. Interactive Mode

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:
  • Output:
    • Logs and progress messages are shown in the console.
  • User can cancel the operation at the confirmation prompt.

Relevant Code:

  • Confirmation prompt:
    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
        }
    }
    OfficeScrubC2R.ps1:952-961

Sources:


2. Silent Mode (-Quiet, -Force)

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 -Quiet is omitted).

Relevant Code:

Table: Silent Mode Effects

Parameter Effect on Script Behavior
-Quiet Suppresses most output and prompts
-Force Skips confirmation, proceeds directly

Sources:


3. Detection-Only Mode (-DetectOnly)

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:

Diagram: Detection-Only Mode Execution Path

stateDiagram-v2
    [*] --> "Main()"
    "Main()" --> "Initialize-Script"
    "Initialize-Script" --> "Find-InstalledOfficeProducts"
    "Find-InstalledOfficeProducts" --> "Show-Summary": "if -DetectOnly"
    "Show-Summary" --> [*]
Loading

Sources:


4. Offline Mode (-Offline)

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:

Relevant Code:

Sources:


5. Force Mode (-Force)

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:

Sources:


6. Unpin-Only Mode (-UnpinMode)

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:

Sources:


Diagram: Operational Mode Decision Flow in Main()

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"
Loading

Sources:


Summary Table: Operational Modes and Their Effects

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:


Additional Notes

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

Clone this wiki locally