Warren Simondson of Ctrl-Alt-Del IT Consultancy has released a command-line utility called REMProf to delete local user profiles that are not in use when this command is executed. Andy Morgan has created a great blog to demonstrate how usefull this tool can be to remove a user profile from multiple Terminal / Citrix servers.
Deleteprofiles.cmd “wrapper” and Scheduled Task creation script.
Place the deleteprofiles.cmd and deleteprofile.vbs scripts in the %SystemRoot% (Windows) folder.
———————Deleteprofiles.cmd————————–
@echo off
SetLocal
Set loglocation=%SystemDrive%\buildlogs
if not exist %loglocation% md %loglocation%
cscript “%SystemRoot%\DeleteProfiles.vbs” /L “%loglocation%\DeleteProfiles.txt” /V
EndLocal
EXIT /b 0
—————————————————————–
However, and we need to go one step deeper here. I create it as a scheduled task that runs at 2:30am every day. One of the bigest advantages of using a script like this is that is can be run as the Local System account, where as Delprof has its issues as documented in Microsoft Technet article KB262223.
———————–SceduledTasks.cmd———————-
@Echo Off
SCHTASKS /Create /TN “Delete inactive profiles” /RU “NT AUTHORITY\SYSTEM” /ST 02:30 /SC Daily /F /TR “%SystemRoot%\DeleteProfiles.cmd”
EXIT /B
—————————————————————-
This method is 100% successful and creates a very good log file that can be reviewed as needed.
Thanks again Joe!
One Comment
Post a Comment