Put the script in the shutdown section of the GPO machine portion. Remark, the part with Case "ADMINISTRATOR" can be modified to keep some profiles from getting deleted.
1: Set fso = CreateObject("Scripting.FileSystemObject")
2: Set outfile = fso.OpenTextFile("C:\profile_Output.txt", 2, True)
3: Set objFolder = fso.GetFolder("C:\Documents and Settings")
4: For Each Profile In objFolder.SubFolders
5: Select Case UCase(Profile.Name)
6: Case "ADMINISTRATOR", "ALL USERS", "NETWORKSERVICE", "LOCALSERVICE", "DEFAULT USER"
7: 'Do nothing
8: Case Else
9: fso.DeleteFolder Profile.Path, True
10: End Select
11: Next
12: For Each Profile In objFolder.Subfolders
13: outfile.writeline Profile.Name & vbCrLf
14: Next
No comments:
Post a Comment