DELPROF - CMD


Overview

DELPROF is a command-line utility in Windows operating systems primarily used to delete user profiles. Profiles that are not currently in use and meet specific criteria set by the command parameters can be removed. This tool is particularly effective in administrative environments like schools, businesses, or organizations where user profiles may accumulate over time on shared computers, potentially consuming valuable disk space and leading to clutter.

Syntax

The basic syntax of DELPROF is:

DELPROF [/Q] [/I] [/P] [/C:\\computername] [/D:days]
  • /Q : Runs the command in quiet mode, deleting profiles without confirmation prompts.
  • /I : Ignores errors and continues deleting other profiles if an error occurs with one.
  • /P : Prompts for confirmation before deleting each profile.
  • /C:\\computername : Specifies the target computer for profile deletion.
  • /D:days : Deletes only profiles not used for more than ‘days’ days. For example, /D:30 will delete profiles not used in the last 30 days.

Options/Flags

  • /Q: Use this flag when you want to perform silent deletions without disrupting the workflow with prompts.
  • /I: Ideal in automated scripts or when executing in batches, where the process should not halt due to minor issues.
  • /P: Adds a layer of safety by ensuring that each deletion is intentional and acknowledged by the user.
  • /C: Target specific machines in a network, useful for centralized administration tasks.
  • /D: Provides control over the age of profiles being deleted, optimizing disk space without affecting recently active users.

Examples

  1. Delete all profiles not used in the last 60 days on the local machine without confirmation:
    DELPROF /D:60 /Q
    
  2. Prompt for confirmation before deleting each profile older than 30 days:
    DELPROF /D:30 /P
    
  3. Delete profiles on a remote computer ‘COMPNAME’ silently:
    DELPROF /C:\\COMPNAME /Q
    

Common Issues

  • Permission Errors: Running DELPROF without sufficient privileges can lead to permission errors. Ensure you run the command as an administrator.
  • Network Issues: When using /C, ensure that the network path is correct and accessible. Issues in network connectivity or path errors can prevent the command from executing.

Integration

DELPROF can be integrated with other commands for comprehensive maintenance or deployment scripts. For example, combining it with SCHTASKS to schedule profile deletions:

SCHTASKS /Create /SC WEEKLY /TN "Clean Up Old Profiles" /TR "DELPROF /D:30 /Q" /ST 00:00

This command creates a scheduled task that runs DELPROF weekly to keep the system clean of old profiles.

  • RD (Remove Directory): Used to delete directories that can be part of a cleanup script.
  • SCHTASKS: Enables scheduling commands like DELPROF to automate system maintenance.

For more details and further reading on related utilities, consult the Windows Command Line documentation.