This is a dangerous operation, designed for use by an administrator who needs to do a complete purge; for instance at the end of a semester.
Note:
For purposes of this example, we will use the following path for the script files:
D:\Scripts
- Copy the below provided code into the notepad and save it as delete_profiles.vbs in D:\Scripts
- Create a new notepad file and copy the following line:
Where SRVNAME is the name of the server where you want to delete the profiles.
The redirection (>) in that command line acts to create (or append) a text file named profile_delete.txt that will act to log the deletions.
- Save it as delete_all_profiles.bat and save it in D:\Scripts
- Create a scheduled job and run delete_all_profiles.bat at the desired time.
I suggest using a batch file and setting up a scheduled task as that lets the script run with the necessary permissions.
Here is the code for the script file: delete_profiles.vbs
NOTES: In line 19 you have to specify the domain name to be used in the script and in line 20 you can specify user accounts that shouldn't be deleted, such as Administrator accounts.
Originally posted on my web site and used with my permission:
http://www.wincert.net/tip
by: nimatejic on 2010-11-14 at 21:07:15ID: 21318
Regards,
Nik