Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Delete User Profile

17 Aug 2010   #1

Windows 7 Enterprise
Delete User Profile

Hi all,
I'd like to delete students cached profile when they log out.
Apparently, delprof.exe does not with with Windows 7, 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?

My System SpecsSystem Spec

18 Aug 2010   #2

Microsoft Community Contributor Award Recipient

Windows 7 Home Premium x64 SP1

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 System SpecsSystem Spec
19 Aug 2010   #3

Windows 7 Enterprise

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 System SpecsSystem Spec

19 Aug 2010   #4

Windows Server 2008 R2

Why not write a script that uses the Win32_UserProfile class to delete unused profiles, or specific profiles?
My System SpecsSystem Spec
19 Aug 2010   #5

Windows 7 Enterprise

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 System SpecsSystem Spec
19 Aug 2010   #6

Windows Server 2008 R2

Very funny
My System SpecsSystem Spec
20 Aug 2010   #7

Windows 7 Enterprise 64bit

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.

My System SpecsSystem Spec
20 Aug 2010   #8

Windows Server 2008 R2

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 System SpecsSystem Spec
20 Aug 2010   #9

Windows 7 Enterprise 64bit

It should be a sweet and simple script.
My System SpecsSystem Spec
22 Aug 2010   #10

Windows 7 Enterprise

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.


My System SpecsSystem Spec

 Delete User Profile

Thread Tools

Our Sites

Site Links

About Us

Find 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 05:04 AM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33