first of all sry if this post is repetitive for the profile deletion.
If you have a correct link please post it below or the script itself.
Question: as i have a lot of computers with windows 7 (2400 systems) as the operating system on them and as the users keep on changing or shifting place from one PC to another PC and managing the system or the C drive for the consistent system performance or freeing space is a challenging task.
I would like have a Script that would only delete old (No of Months) profile as well as the registry itself but should keep the current profile instanct the the registry too.
I did find the script on some forum that gets the job done but not the right way as it deletes all the profile and excludes the admin,administrator etc in the script but i cannot delete the old profile of a certain time or date period.
As again sorry if this post looks like mess but help is appreciated
Best Answer
If your workstations are domain joined and you have access to modify group policies then all of this can be specified in GPO;
Alternatively you should look at delprof2 (https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/), this will do what you need.
It's a command line tool (so you can script it) and takes a parameter to specify how old a profile must be before it's eligible for deletion. For example this command will delete all local profiles older than 60 days;
It has more uses too, such as only deleting profiles that are local caches of roaming profiles (ignoring true local profiles), deleting profiles remotely (so you could potentially script this to run from a server and target each of your workstations in turn), pattern matching for inclusion / exclusion so you can tell it to ignore specific profiles (e.g. all accounts starting with john*).
It's also free in many cases (I quote)
Does that help?
Edit:
Seeing as you appear to want an additional option, try this script or a modification of it. I found it on this forum (http://www.edugeek.net/forums/windows-7/79028-delete-user-profiles-older-than-specified-number-days.html) and it is entirely untested; use at your own risk. You'll probably want to remove the MsgBox line, and the unused period can be adjusted by changing the value of variable 'intMaxProfileAge'