DELPROF (XP/2003 Server Resource Kit - download)

Delete windows user profiles. Does not work with Windows 7 or later.

Syntax
      DELPROF [options days]

Key
   /Q      Quiet, no confirmation.

   /I      Ignore errors and continue deleting.

   /P      Prompts for confirmation before deleting each profile.

   /C:\\computer_name
           Delete profiles on a remote computer.

   /D:Number_of_days
           Only delete profiles that have been inactive for
           'X' Number of days (or greater)

   /R      Delete roaming profile cache only

Alternatives

PS C:\> Get-CimInstance -ComputerName 'workstation64' -Class Win32_UserProfile | Where-Object { $_.LocalPath.split('\')[-1] -eq 'User64' } | Remove-CimInstance

The LocalPath of the profile will normally end in the username but if a user account is renamed the path will not update and will retain the old name.

“The best way to destroy the capitalist system is to debauch the currency” ~ John Keynes

Related commands

WMI/PowerShell script to delete user profiles - Idera.
Delprof2 - Delete Profiles Utility (Helge Klein).
DELTREE - Delete a folder and all subfolders.
RD - Delete folders or entire folder trees.


 
Copyright © 1999-2023 SS64.com
Some rights reserved