Scripting Question

Removing User Profiles in Windows 7

05/01/2015 3430 views
Hello everyone,

I was wondering how everyone has been dealing with the removal of user profiles on Windows 7. We have some machines on campus that have 100+ user folders from domain-users logging in. How does everyone handle removing these? We tried setting the GPO to remove accounts that are older than X amount of days however, that didn't work as I believe our anti-virus (Sophos) accesses the user folders keeping them from having a date that's older than so many days. 
1 Comment   [ + ] Show comment


  • you need to look at using deepfreeze on your lab computers to keep this from happening.

All Answers

With larger drives we haven't had too many problems like this lately but from time to time do still use delprof in our labs on Win7. The documentation states it isn't compatible but in my experience it works.


Answered 05/01/2015 by: jegolf
Red Belt

  • The main reason we have to do it is because we have scripts that run at login that add the printers for the users however, we've noticed if the number of users gets too high then the script takes a while to run and our students tend to get pretty impatient
    • Right on - sorry I just mentioned that just in case it didn't work for you...
      • Haha nah I appreciate it! The reason I brought it up was to ask how you go about dealing with printers in lab-areas. Do you recommend a better way of having that set up?
  • We actually changed from a startup script to deploying via group policy preferences this year. It has been working much better. No more command window pop ups on login, waiting on driver installs, etc.If you deploy via the user configuration you can set the default as well.
delprof2 works like Microsoft delprof but also works with Vista and above.
Answered 05/01/2015 by: flip1001
Black Belt

  • We use delprof2 also. I have scripts setup in KACE to run it nightly on our lab machines to delete profiles that haven't been used in over 7 or 30 days, depending on the lab.
    • How are you having it run automatically from KACE?
      • I created a script with the following settings:
        Type: Offline KScript
        Dependencies: Upload delprof2.exe
        Task 1:
        Verify that the directory c:\users exists
        I also have a verification that the computer name does not end in -inst as we do not want to delete profiles from instructor computers (faculty don't like that).
        On Success:
        Launch a program
        Directory: $(KACE_DEPENDENCY_DIR)
        File: DelProf2.exe
        Wait for completion: checked
        Parameters: /u /q /d:7 /ed:adminaccount /i

        This deletes profiles that have not been used for seven days and excludes our local admin account from being deleted.

        This script is scheduled to run every day at 3:10am and we assign the labels for the classrooms that we want the profiles to be cleaned. I have another script which is identical but deletes profiles that haven't been used for 30 days (/d:30).
chucksteel's steps worked beautifully as always - thanks so much! This is going to save a lot of manhours and frustration. Cheers!
Answered 05/07/2015 by: SHRIVES93
Yellow Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ