hello

 

I want to delet files in user profile but use system accoutnd how can i do it?

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2

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.

Answered 08/29/2012 by: Arminius
Second Degree Green Belt

Please log in to comment

Answers

1

A simple DOS command, I use for this is:

C:

CD "Documents and Settings"

DEL /F /S /Q "FileName.extension"

(Or C:\Users for Win7)

  • /F - Force deleting of read-only files.
  • /S - Delete specified files from all subdirectories.
  • /Q - Quiet mode, do not ask if ok to delete on global wildcard
Answered 08/29/2012 by: andemats
Second Degree Black Belt

Please log in to comment
1

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..

 

Answered 08/29/2012 by: jagadeish
Red Belt

  • And run this script in Active Setup.
    • 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)
Please log in to comment
Answer this question or Comment on this question for clarity