Skip to content

delprof2_delete_old_profiles.ps1

Corey Watson edited this page Dec 19, 2025 · 1 revision

delprof2_delete_old_profiles.ps1

Deletes Windows user profiles older than a specified number of days.

Overview

This script deletes Windows user profiles older than a specified number of days. Uses DelProf2 utility downloaded directly from helgeklein.com.

Purpose

Deletes Windows user profiles older than a specified number of days. Uses DelProf2 utility downloaded directly from helgeklein.com.

Prerequisites

  • Windows 10/11
  • Admin privileges required
  • Internet access for DelProf2 download

Configuration

Data Sources & Priority

  1. SuperOps runtime variables
  2. Direct download from helgeklein.com

Required Inputs (SuperOps Runtime Variables)

  • $days_old : Number of days - profiles older than this are deleted (default: 30)

Settings

  • Always protects: gaia, administrator profiles
  • Downloads DelProf2 directly (no Chocolatey required)
  • Cleans up after execution

Behavior

  1. Downloads/extracts DelProf2 if not cached
  2. Executes: delprof2.exe /u /d:X /ed:gaia /ed:administrator
  3. Cleans up cached files
  4. Reports results

Security Notes

  • DESTRUCTIVE OPERATION - profiles cannot be recovered
  • Downloads from official helgeklein.com source

Exit Codes

  • 0: Success
  • 1: Failure

Example Output

[ INPUT VALIDATION ]
--------------------------------------------------------------
Days Old  : 30
Protected : gaia, administrator

[ OPERATION ]
--------------------------------------------------------------
Downloading DelProf2...
Extracting...
DelProf2 ready
Executing: DelProf2.exe /u /d:30 /ed:gaia /ed:administrator
[DelProf2 output]
Cleaning up...

[ RESULT ]
--------------------------------------------------------------
Status : Success

[ SCRIPT COMPLETED ]
--------------------------------------------------------------

Version History

  • 2025-11-29 v1.0.0 Initial release - separated from combined script

Links

Clone this wiki locally