Skip to content

System Requirements

Calvindd2f edited this page Jan 14, 2026 · 1 revision
Relevant source files

The following files were used as context for generating this wiki page:

This document specifies the technical prerequisites for installing and running OfficeScrubC2R.

For installation procedures, see Installation. For troubleshooting, see Troubleshooting.


Core Platform Requirements

Requirements are enforced at the module manifest level (OfficeScrubC2R.psd1) and during runtime initialization.

Operating System Requirements

Requirement Value
Minimum OS Windows 7 SP1
Recommended OS Windows 10 or Windows 11
Architecture x86 (32-bit) or x64 (64-bit)

The native C# library (OfficeScrubNative.dll) uses Win32 APIs available on Windows 7 SP1 and later. The ProcessorArchitecture is set to 'None' at OfficeScrubC2R.psd1:35, supporting both 32-bit and 64-bit architectures. The RegistryHelper class implements WOW64 registry view handling for 64-bit systems.

Sources: OfficeScrubC2R.psd1:35, docs/memory-bank/product.md:60-64

PowerShell Version Requirements

Requirement Value Enforcement
Minimum Version 5.1 OfficeScrubC2R.psd1:29
Compatible Editions Desktop, Core OfficeScrubC2R.psd1:9

The PowerShellVersion is set to '5.1' at OfficeScrubC2R.psd1:29. The CompatiblePSEditions array specifies @('Desktop', 'Core') at OfficeScrubC2R.psd1:9, supporting:

  • Windows PowerShell 5.1 (Desktop edition)
  • PowerShell 7.x (Core edition)

PowerShell validates these requirements during Import-Module before executing any module code.

Sources: OfficeScrubC2R.psd1:9, OfficeScrubC2R.psd1:29, docs/memory-bank/product.md:61

.NET Framework Requirements

Requirement Value Enforcement
.NET Framework 4.5 or later OfficeScrubC2R.psd1:32

The DotNetFrameworkVersion is set to '4.5' at OfficeScrubC2R.psd1:32. The native library OfficeScrubNative.dll uses .NET 4.5+ features including Task.Run, Parallel.ForEach, and modern P/Invoke signatures. The module fails to load if .NET Framework 4.5+ is not available.

Sources: OfficeScrubC2R.psd1:32, docs/memory-bank/product.md:62, docs/memory-bank/tech.md:19-23


Runtime Requirements

Administrator Privileges

Requirement: Administrator rights (elevated token)
Enforcement: Runtime validation

Administrator privileges are required for operations performed by the native helper classes:

  • RegistryHelper: Modifies HKEY_LOCAL_MACHINE and HKEY_CLASSES_ROOT
  • FileHelper: Deletes files from C:\Program Files and C:\ProgramData
  • ServiceHelper: Stops and removes Windows services
  • ProcessHelper: Terminates protected Office processes
  • WindowsInstallerHelper: Modifies MSI registration data

Elevation validation occurs during module initialization:

# Verify elevation status
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

Sources: docs/memory-bank/product.md:63, docs/memory-bank/guidelines.md:128-133

Required Assemblies

Assembly Purpose
OfficeScrubNative.dll Native performance layer

The RequiredAssemblies is set to an empty array at OfficeScrubC2R.psd1:43 with a comment indicating dynamic loading. The PowerShell module (OfficeScrubC2R.psm1) implements the Import-OfficeScrubNative function that loads the assembly dynamically to avoid conflicts when the assembly is already loaded.

Assembly loading follows this sequence:

  1. Attempt to load pre-compiled OfficeScrubNative.dll from module directory
  2. If loading fails, compile from OfficeScrubC2R-Native.cs using Add-Type
  3. Module import fails if both paths fail

Fallback compilation requires csc.exe availability and write permissions to the temporary directory.

Sources: OfficeScrubC2R.psd1:40-43, docs/memory-bank/tech.md:28-55


Dependency Architecture

Diagram: System Requirements to Module Initialization

graph TB
    subgraph SysReq["System Requirements"]
        OS["Windows 7 SP1+"]
        PS["PowerShell 5.1+"]
        NET[".NET Framework 4.5+"]
        ADMIN["Administrator Rights"]
    end
    
    subgraph ManifestCheck["OfficeScrubC2R.psd1"]
        PSVer["PowerShellVersion = '5.1'<br/>Line 29"]
        NETVer["DotNetFrameworkVersion = '4.5'<br/>Line 32"]
        PSEd["CompatiblePSEditions<br/>Line 9"]
        Arch["ProcessorArchitecture = 'None'<br/>Line 35"]
    end
    
    subgraph ModuleLoad["OfficeScrubC2R.psm1"]
        ImportNative["Import-OfficeScrubNative"]
        NewOrch["New-OfficeScrubOrchestrator"]
        TestPath["Test-OfficeC2RPath"]
        TestScope["Test-OfficeProductScope"]
    end
    
    subgraph NativeLayer["OfficeScrubNative.dll"]
        Orch["OfficeScrubOrchestrator"]
        RegH["RegistryHelper"]
        FileH["FileHelper"]
        ProcH["ProcessHelper"]
        WinInstH["WindowsInstallerHelper"]
    end
    
    subgraph Win32["Win32 APIs"]
        AdvApi["advapi32.dll<br/>RegOpenKeyEx, RegDeleteKeyEx"]
        Kernel["kernel32.dll<br/>MoveFileEx, SetFileAttributes"]
        Shell["shell32.dll<br/>IShellItem"]
    end
    
    PS --> PSVer
    PS --> PSEd
    NET --> NETVer
    OS --> Arch
    
    PSVer --> ImportNative
    NETVer --> ImportNative
    
    ImportNative --> Orch
    NewOrch --> Orch
    
    Orch --> RegH
    Orch --> FileH
    Orch --> ProcH
    Orch --> WinInstH
    
    RegH --> AdvApi
    FileH --> Kernel
    ProcH --> Kernel
    WinInstH --> AdvApi
    
    ADMIN -.validates at runtime.-> NewOrch
Loading

The manifest file OfficeScrubC2R.psd1 enforces PowerShell and .NET Framework versions before module code executes. The root module OfficeScrubC2R.psm1 exports functions that load and initialize the native assembly. The OfficeScrubOrchestrator class coordinates helper classes that invoke Win32 APIs through P/Invoke declarations.

Sources: OfficeScrubC2R.psd1:9, OfficeScrubC2R.psd1:29, OfficeScrubC2R.psd1:32, OfficeScrubC2R.psd1:35, docs/memory-bank/tech.md:84-94


Compatibility Matrix

PowerShell Edition Compatibility

PowerShell Version Edition Windows Version Status
5.1 Desktop Windows 10/11 Supported
5.1 Desktop Windows 7 SP1 Supported
7.0+ Core Windows 10/11 Supported
< 5.1 Any Any Not supported

The CompatiblePSEditions array at OfficeScrubC2R.psd1:9 declares support for @('Desktop', 'Core').

Sources: OfficeScrubC2R.psd1:9

.NET Framework Version Compatibility

.NET Version Status
4.8 Supported
4.7.x Supported
4.6.x Supported
4.5.x Supported (minimum)
4.0 Not supported

The module requires .NET Framework 4.5 or later as specified at OfficeScrubC2R.psd1:32.

Sources: OfficeScrubC2R.psd1:32, docs/memory-bank/tech.md:19-23


Requirement Validation

Pre-Installation Validation

Validate system requirements before installation:

# Check PowerShell version (requires 5.1+)
$PSVersionTable.PSVersion

# Check PowerShell edition (requires Desktop or Core)
$PSVersionTable.PSEdition

# Check .NET Framework version (requires 4.5+, release >= 378389)
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release | 
    Select-Object -ExpandProperty Release

# Check elevation status (requires True)
([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

Sources: OfficeScrubC2R.psd1:9, OfficeScrubC2R.psd1:29, OfficeScrubC2R.psd1:32

Module Loading Sequence

Diagram: Import-Module Validation Flow

stateDiagram-v2
    [*] --> ManifestCheck
    
    state ManifestCheck {
        [*] --> PSVerCheck
        PSVerCheck --> PSEdCheck: PSVersion >= 5.1
        PSVerCheck --> ErrorPSVer: PSVersion < 5.1
        PSEdCheck --> NETCheck: Desktop or Core
        PSEdCheck --> ErrorPSEd: Other edition
        NETCheck --> ManifestOK: .NET >= 4.5
        NETCheck --> ErrorNET: .NET < 4.5
    }
    
    ManifestCheck --> LoadModule: Manifest valid
    ManifestCheck --> Failed: Validation failed
    
    state LoadModule {
        [*] --> LoadPSM1
        LoadPSM1 --> ExportFuncs: OfficeScrubC2R.psm1
        ExportFuncs --> ModuleReady
    }
    
    LoadModule --> Ready: Module loaded
    
    state Ready {
        [*] --> ImportNative
        ImportNative --> LoadDLL: Import-OfficeScrubNative
        LoadDLL --> DLLLoaded: OfficeScrubNative.dll
        LoadDLL --> CompileCS: DLL load failed
        CompileCS --> DLLLoaded: Compile from source
        CompileCS --> ErrorLoad: Compilation failed
        DLLLoaded --> CreateOrch: New-OfficeScrubOrchestrator
        CreateOrch --> ValidateAdmin
        ValidateAdmin --> Operational: Admin rights verified
        ValidateAdmin --> ErrorAdmin: Not elevated
    }
    
    Ready --> Operational: Ready to use
    Ready --> Failed: Initialization failed
    
    Operational --> [*]
    Failed --> [*]
    ErrorPSVer --> [*]
    ErrorPSEd --> [*]
    ErrorNET --> [*]
    ErrorLoad --> [*]
    ErrorAdmin --> [*]
Loading

Manifest validation occurs in Import-Module before executing module code. The manifest enforces PowerShellVersion at OfficeScrubC2R.psd1:29, CompatiblePSEditions at OfficeScrubC2R.psd1:9, and DotNetFrameworkVersion at OfficeScrubC2R.psd1:32. Module functions load the native assembly dynamically via Import-OfficeScrubNative. Administrator validation occurs when creating the orchestrator with New-OfficeScrubOrchestrator.

Sources: OfficeScrubC2R.psd1:3, OfficeScrubC2R.psd1:9, OfficeScrubC2R.psd1:29, OfficeScrubC2R.psd1:32, OfficeScrubC2R.psd1:58-64


Hardware Considerations

OfficeScrubC2R has no explicit hardware requirements. Performance characteristics:

Component Impact
CPU cores Multi-core improves parallel operations in ProcessHelper.TerminateProcesses and registry enumeration
RAM 2+ GB recommended for native library operations
Disk SSD improves file deletion operations in FileHelper
Disk I/O Higher IOPS improves RegistryHelper enumeration performance

The native library uses Parallel.ForEach and Task.Run for concurrent operations. Multi-core CPUs improve registry enumeration and file deletion.

Sources: docs/memory-bank/product.md:9-32, docs/memory-bank/tech.md:96-109


Requirement Enforcement Mapping

Diagram: Requirement to Code Entity Mapping

graph TB
    subgraph Requirements["Requirements"]
        ReqPS["PowerShell 5.1+"]
        ReqED["Desktop/Core"]
        ReqNET[".NET 4.5+"]
        ReqOS["Windows 7 SP1+"]
        ReqAdmin["Admin Rights"]
        ReqArch["x86/x64"]
    end
    
    subgraph Manifest["OfficeScrubC2R.psd1"]
        L29["Line 29<br/>PowerShellVersion"]
        L9["Line 9<br/>CompatiblePSEditions"]
        L32["Line 32<br/>DotNetFrameworkVersion"]
        L35["Line 35<br/>ProcessorArchitecture"]
        L43["Line 43<br/>RequiredAssemblies"]
    end
    
    subgraph PSM1["OfficeScrubC2R.psm1"]
        ImportNativeFunc["Import-OfficeScrubNative"]
        NewOrchFunc["New-OfficeScrubOrchestrator"]
        TestC2RFunc["Test-OfficeC2RPath"]
        TestScopeFunc["Test-OfficeProductScope"]
    end
    
    subgraph DLL["OfficeScrubNative.dll"]
        OrchClass["OfficeScrubOrchestrator"]
        RegHelperClass["RegistryHelper"]
        FileHelperClass["FileHelper"]
        ProcHelperClass["ProcessHelper"]
        WIHelperClass["WindowsInstallerHelper"]
    end
    
    subgraph APIs["Win32 P/Invoke"]
        AdvApi32["advapi32.dll<br/>RegOpenKeyEx<br/>RegDeleteKeyEx"]
        Kernel32["kernel32.dll<br/>MoveFileEx<br/>SetFileAttributes"]
    end
    
    ReqPS --> L29
    ReqED --> L9
    ReqNET --> L32
    ReqArch --> L35
    
    L29 --> ImportNativeFunc
    L9 --> ImportNativeFunc
    L32 --> ImportNativeFunc
    L43 --> ImportNativeFunc
    
    ImportNativeFunc --> OrchClass
    NewOrchFunc --> OrchClass
    
    OrchClass --> RegHelperClass
    OrchClass --> FileHelperClass
    OrchClass --> ProcHelperClass
    OrchClass --> WIHelperClass
    
    RegHelperClass --> AdvApi32
    FileHelperClass --> Kernel32
    ProcHelperClass --> Kernel32
    WIHelperClass --> AdvApi32
    
    ReqOS --> AdvApi32
    ReqOS --> Kernel32
    ReqAdmin -.runtime check.-> NewOrchFunc
Loading

The manifest enforces requirements before module execution. Functions in OfficeScrubC2R.psm1 coordinate native class instantiation. Helper classes invoke Win32 APIs that require Windows 7 SP1+. Administrator rights are validated at runtime when creating the orchestrator.

Sources: OfficeScrubC2R.psd1:9, OfficeScrubC2R.psd1:29, OfficeScrubC2R.psd1:32, OfficeScrubC2R.psd1:35, OfficeScrubC2R.psd1:43, OfficeScrubC2R.psd1:58-64


Troubleshooting

PowerShell Version Error

Error: Module requires PowerShell 5.1 or later

Check version:

$PSVersionTable.PSVersion

Solution: Install Windows Management Framework 5.1 or PowerShell 7+

.NET Framework Error

Error: Could not load assembly or manifest validation failure

Check version:

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release | 
    Select-Object -ExpandProperty Release
# Requires >= 378389

Solution: Install .NET Framework 4.8 (includes 4.5+)

Native DLL Load Error

Error: Could not load OfficeScrubNative.dll

Check DLL:

Get-ChildItem -Path $ModulePath -Filter OfficeScrubNative.dll | Unblock-File
Test-Path "$ModulePath\OfficeScrubNative.dll"

Solution: Unblock DLL or ensure csc.exe is available for fallback compilation

Elevation Error

Error: Administrator privileges required

Check elevation:

([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

Solution: Run PowerShell as Administrator using Start-Process powershell -Verb RunAs

Sources: OfficeScrubC2R.psd1:29, OfficeScrubC2R.psd1:32, docs/memory-bank/tech.md:144-157


Summary

OfficeScrubC2R requires:

  1. Operating System: Windows 7 SP1 or later (x86/x64)
  2. PowerShell: Version 5.1+ (Desktop or Core edition)
  3. Runtime: .NET Framework 4.5 or later
  4. Privileges: Administrator rights (elevated token)
  5. Dependencies: OfficeScrubNative.dll or ability to compile from source

These requirements are enforced at multiple levels:

  • Manifest level: PowerShell version, .NET Framework version, required assemblies OfficeScrubC2R.psd1:38-50
  • Import level: Assembly loading with smart fallback to compilation
  • Runtime level: Administrator privilege validation during initialization

Systems meeting these requirements can achieve 10-50x performance improvements over the original VBScript implementation through the native performance layer.

For installation instructions after verifying requirements, proceed to Installation.

Sources: OfficeScrubC2R.psd1:1-175, README.md:21-26

Clone this wiki locally