What Kat Did

Menu

Skip to content
  • Home
  • About

Tag Archives: User Profile

26Feb2014

Deleting local user profiles

Posted in Microsoft by Kat

This is more of a one off utility to use when things go wrong but using GPO to delete profiles over a certain age is much tidier. I needed to clear all profiles (even the ones that were used on the same day). The story why it got to this point is quite long but lets just say that if you’re moving redirected folders to a different server definitely make changes to your GPO first.

Some useful articles on this:

http://www.microsoft.com/en-gb/download/details.aspx?id=5405
http://social.technet.microsoft.com/Forums/en-US/4e7df397-7b93-41ab-8448-2503c63568f6/how-to-move-redirected-files-from-one-server-to-another?forum=winserverGP

So if for any reason you’d like to delete local user profiles from a bunch of PCs you will definitely find the Delprof utility useful. For Windows XP and lower you can download to file from Microsoft. You will however notice that this is no good for Windows 7, that’s where Helge Klein’s Delprof2 comes in handy. The software is free to use for non-profit and educational organisations which nicely covered my client. The commercial license costs around £260 which isn’t that small amount but if you’re going to get some use out of it it’s not ridiculous either.

I had nearly 900 PCs to contend with and wanted to run delprof2 against a list of PC names. For this purpose I’ve written a fairly simple batch file, which no doubt could be much improved but it did the job quite nicely.

@echo off
del /q log.txt 2>nul
del /q errorlog.txt 2>nul

for /f %%i in (pclist.txt) do call :proc %%i
goto :end

:proc
echo processing %1 …

ping -n 2 %1 >nul 2>nul
if %ERRORLEVEL% gtr 0 (
echo -offline
echo %1 -offline >>errorlog.txt
goto :EOF
)

echo deleting on %1
echo deleting on %1>>log.txt

DelProf2.exe -c:%1 -i -q

echo %1 Complete
echo %1 Complete>>log.txt

goto :EOF

:end

This script assumes there’s a PClist.txt file containing a list of computer names (IP addresses would work too) and delprof2.exe in the same directory as the batch file itself.

Advertisement
Delprof, Script, User Profile Leave a comment
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • What Kat Did
    • Already have a WordPress.com account? Log in now.
    • What Kat Did
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar