Skip to content

delprof2_keep_selected_profile.ps1

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

delprof2_keep_selected_profile.ps1

Deletes ALL Windows user profiles EXCEPT the specified profile and protected ones (gaia, administrator).

Overview

This script uses the DelProf2 utility to remove all Windows user profiles except for a specified profile and system-protected profiles. It's designed for RMM platform deployment with SuperOps runtime variables.

Purpose

Deletes ALL Windows user profiles EXCEPT the specified profile and protected ones (gaia, administrator). Uses DelProf2 utility.

Prerequisites

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

Configuration

Required Inputs

SuperOps Runtime Variables:

  • $profile_to_keep : Username of the profile to preserve

Settings

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

Data Sources & Priority

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

Behavior

  1. Downloads/extracts DelProf2 if not cached
  2. Executes: delprof2.exe /u /ed:PROFILENAME /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 ]
--------------------------------------------------------------
Profile to Keep : john.doe
Protected       : gaia, administrator

[ OPERATION ]
--------------------------------------------------------------
Using cached DelProf2
Executing: DelProf2.exe /u /ed:john.doe /ed:gaia /ed:administrator
[DelProf2 output...]
Cleaning up...

Version History

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

Links

Clone this wiki locally