how to delete files in user profile
hello
I want to delet files in user profile but use system accoutnd how can i do it?
Answers (3)
I did it in Winbatch, but here's the overall logic:
check in HKLM\Software\Microsoft\Windows NT\CurrentVersion\profilelist to get a list of profiles and SIDS known on the PC
Then check out Software\Microsoft\Windows NT\CurrentVersion\Profilelist\[SID]\profileimagepath to see where those profiles point
If the SID is less than 20 characters in length, ignore it. Otherwise, use that path to check if the folder you want to delete exists, and if so, delete it.
the nice thing about finding these pieces of info in the registry is that you get the SIDS out of this, so if you have other work to do (like cleaning up ActiveSetup), you already have SIDS and IDs associated with one another. Also, that gives you the path so you don't need to worry about XP vs Win 7.
You can write VBScript to delete files from <UserProfile>..
Find out what are the folders available in C:\Users folder...(If you are working on >Windows XP)
Ignore the Default folders... like Public, Administrator, Default etc..
Based on that you can delete files from each user profile if it exists..
Comments:
-
And run this script in Active Setup. - piyushnasa 12 years ago
-
and if you don't want a log off trying enuremuting the HKEY_USERS registry key to delete the user specific file from the logged in user and then active setup would take care of the remaining stuff ...
If you want to make use of the deployment tool and then run the required script with user context(No need to any log off or active setup here) - sumitsingh1984 12 years ago