Deleting User Profiles


If you need to clear out old user profiles and files you can use the delprof2 utility and SyAM Management Utilities to automate the process


Download the tool and copy to your shared folder


https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/



Usage: delprof2 [/l] [/u] [/q] [/p] [/r] [/c:[\\]<computername>] [/d:<days> [/ntuserini]] [/ed:<pattern>] [/id:<pattern>] [/i]


       /l   List only, do not delete (what-if mode)

       /u   Unattended (no confirmation)

       /q   Quiet (no output and no confirmation)

       /p   Prompt for confirmation before deleting each profile

       /r   Delete local caches of roaming profiles only, not local profiles

       /c   Delete on remote computer instead of local machine

       /d   Delete only profiles not used in x days

       /ntuserini

            When determining profile age for /d, use the file NTUSER.INI

            instead of NTUSER.DAT for age calculation

       /ed  Exclude profile directories whose name matches this pattern

            Wildcard characters * and ? can be used in the pattern

            May be used more than once and can be combined with /id

       /id  Include only profile directories whose name matches this pattern

            Wildcard characters * and ? can be used in the pattern

            May be used more than once and can be combined with /ed

       /i   Ignore errors, continue deleting



Create a batch file to run the tool with your defined parameters


In our example we are removing profiles for all user profiles that are over 30 days old quietly except for users profiles containing syam* or admin* in their name


mkdir C:\ProfileDelete

xcopy /Y \\192.168.200.36\apps\DelProf2.exe /s C:\ProfileDelete

c:

cd\

cd ProfileDelete

DelProf2.exe /q /d:30 /ed:syam* /ed:admin*

cd\

rd c:\ProfileDelete /S /Q

exit



Create a Third Party Template to run the batch file