Delete User Profile

Page 1 of 2 12 LastLast

  1. Posts : 966
    Windows 7 Enterprise
       #1

    Delete User Profile


    Hi all,
    I'd like to delete students cached profile when they log out.
    Apparently, delprof.exe does not with with Win7, and the method has been replaced with the GPO setting
    ComputerConfig>Admin Templates>System>User Profiles>Delete Cached Copies of Roaming Profiles.

    However, this is happening at the Workstation level. Preferably I'd like to get it done at a User level, so I can add it to the User-Student GPO.
    I dont want the lecturers profiles to be deleted, just the students.

    We also dont want to use any 3rd party tools.

    Any suggestions?
    Regards,
      My Computer


  2. Posts : 53,365
    Windows 10 Home x64
       #2

    Hello xarden, I see this has gone unanswered, I have no experience in this area, but in Googling I found something close I believe. Perhaps with this at the top, someone else will have an answer if this doesn't help you.

    Windows 7 profile remote deletion.

    A Guy
      My Computer


  3. Posts : 966
    Windows 7 Enterprise
    Thread Starter
       #3

    Thanks A Guy,
    I saw that thread too when googling.
    The issue with that one is if I specify a number of days, such as 3, the machine will accumulate 3 days worth of students profiles (about 6 a day, assuming students use a different machine each day).

    If I specify anything less, the lecturers profile will get deleted over the weekend.

    And just to throw a spanner into the works, some admin staff use multiple machines for days at a time, so this setting wouldnt work well for them either.

    Its kind of a shame that the computerConfig settings wont get applied if its in the Accounts policy... else this would work.
      My Computer


  4. Posts : 2,528
    Windows 10 Pro x64
       #4

    Why not write a script that uses the Win32_UserProfile class to delete unused profiles, or specific profiles?
      My Computer


  5. Posts : 966
    Windows 7 Enterprise
    Thread Starter
       #5

    Because that would the logical thing to do. I like to make things as difficult as possible.

    But when the coffee isnt talking, thats probably the good way to go...
    I've got the image coming down now, so I'l try write something up and test it later today.

    Thanks for your suggestion, will keep you posted how it works out.
      My Computer


  6. Posts : 2,528
    Windows 10 Pro x64
       #6

    Very funny :)
      My Computer


  7. Posts : 38
    Windows 7 Enterprise 64bit
       #7

    What I would do is run a PowerShell logoff script with and set the Scope to groups 1 and 2. The PowerShell script would compare the logged in user to that of users in 1 of 2 groups and if true delete profile or leave alone. I know it sounds easier than it is. But thats the theory at least.

    I don't see how you can manage this cleanly without intergrating with the Security Groups held in Active Directory. I can help out with some of the code if you like.

    The PowerShell Get-ADGroup cmdlet seems like a good place to start.
    http://technet.microsoft.com/en-us/library/ee617196.aspx

    Nick
      My Computer


  8. Posts : 2,528
    Windows 10 Pro x64
       #8

    That would be the best way - users whose profiles you don't want to whack in one group, users whose profiles should be removed in another. Given that Win32_UserProfile also gives the last used date, you could use that as a variable as well.
      My Computer


  9. Posts : 38
    Windows 7 Enterprise 64bit
       #9

    It should be a sweet and simple script.
      My Computer


  10. Posts : 966
    Windows 7 Enterprise
    Thread Starter
       #10

    Attached is a script I found online to delete user profiles using the win32_userprofile class Cluberti suggested.

    What it does, is look for all users and has a msgbox popup asking whether to delete the user profile.

    I've added lines to exlude and ignore system users (s-1-5-18, s-1-5-19, s-1-5-20).
    Will need to exclude local admins, so will be doing that later this week.

    When run manually, it'll detect all previous users and prompt to delete their profiles.
    It'l fail to delete the current user, because they are still logged in.
    So I'l still need to work on getting that done at logout.

    delprof.vbs
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:45.
Find Us