Scripting Deletion of User Profiles

Status
Not open for further replies.

pachecod

Solid State Member
Messages
9
I am writing a script to delete the user profile folders under "c:\Documents and Settings\<username>." The script will not work on profile folders created automatically by Windows. I can, as an Administrator, right-click on the folder and delete it, but running the script under Administrator will not work. I used Group Policy to have the script run as a starup script having SYSTEM privilages and that did not work either. To test that the script works, I created a folder under "c:\Documents and Settings\<username>" and ran the script against it and it was deleted (but this was a folder I manually created). I would assume that there are some permissions problems with having the script take care of this task. Another little thing about what I'm trying to do is that I'm trying to delete only certain profiles. I work for a school district and all of our students are referenced by a numerical student ID in the Active Directory. When the profiles are created they have numerical profile folder names. I am using Visual Basic Script to try and delete these on a regular basis. There, however, is some type of issue in having a script do this. I tried to use the delprof.exe tool that comes with Win2k and WinXP, but there is no way to have that delete only numeric profiles. I even tried having the scrip work with delprof.exe but it still is indiscrimnant about what it deletes. The cause for automation is a just one--with 15,000 users some of the machines can have up to 80 profiles that otherwise must be manually deleted (very time consuming). Sometimes the students use them only once, leaving a profile that is around 5-7MB in size to take up nothing but disk space. I've already done extensive research on this and have tried everything that I thought of and uncovered, but all to no avail. Any help would be greatly appreciated.
 
'3:15 PM 6/14/2004 Script to change the local administrator password on each local machine.

strComputer = "."
Set objUser = GetObject("WinNT://" & strComputer & _
"/Administrator,user")
objUser.SetPassword "newpassword1"
objUser.SetInfo
 
Status
Not open for further replies.
Back
Top Bottom