chrbb Posted March 13, 2008 Posted March 13, 2008 Is there anyway to use run delprof to only delete certain profiles eg class1 class2 etc and leave staff profiles? I've found threads to delete all profiles but leave all users, admin and default but nothing to only delete certain ones.
Lithium Posted March 13, 2008 Posted March 13, 2008 If students use Roaming Profiles (mandatory is classed here too) and Staff don't... you can... Otherwise I guess you'd need to look at a VBS script to do it, I think there's one or two here on Edugeek, if not, they're easy enough to find. Not particularly brilliant with delprof, but I don't think it can...
FN-GM Posted March 13, 2008 Posted March 13, 2008 Function Main() On Error Resume Next Dim obtainfolder Dim Pathfinder Dim strPath Set fso = CreateObject("Scripting.FileSystemObject") strPath = "C:\Documents and Settings\" set excludefile = fso.OpenTextFile("\\server\SYSVOL\networkname.co.uk\scripts\cleanprofiles\exclude.txt", 1) excludelist = excludefile.Readall 'msgbox excludelist Set f = fso.GetFolder(strPath) ' Loop through all subfolders For Each fldrItem in f.SubFolders fldrName = fldrItem.name If Right(strPath,1) <> "\" Then Pathfinder = strPath & "\" & fldrName Else Pathfinder = strPath & fldrName End If If InStr(1, excludelist, fldrName, 1) Then 'msgbox "Has not deleted " & fldrName Else 'msgbox "Deleting " & fldrName set obtainfolder = fso.GetFolder(Pathfinder) obtainfolder.Delete true End If 'End Select Next ' Clean up objects Set fso = Nothing Set fc = Nothing End Function call Main() If you alter the location of the text file and inside that list profiles you don't want to be deleted such as the default profile. Thats a vbs startup script by the way
pwds Posted February 4, 2010 Posted February 4, 2010 Simpler script to do this where you have a naming convention for students where the start of the username is the year of entry (as with us) is- Set FSO = CreateObject("Scripting.FileSystemObject") DelProfiles FSO.GetFolder("C:\Documents and Settings") Sub DelProfiles(Folder) For Each Subfolder in Folder.SubFolders If Left(Subfolder.Path,27) = "C:\Documents and Settings\4" Then FSO.DeleteFolder(Subfolder.Path) ElseIf Left(Subfolder.Path,27) = "C:\Documents and Settings\5" Then FSO.DeleteFolder(Subfolder.Path) ElseIf Left(Subfolder.Path,27) = "C:\Documents and Settings\6" Then FSO.DeleteFolder(Subfolder.Path) ElseIf Left(Subfolder.Path,27) = "C:\Documents and Settings\7" Then FSO.DeleteFolder(Subfolder.Path) ElseIf Left(Subfolder.Path,27) = "C:\Documents and Settings\8" Then FSO.DeleteFolder(Subfolder.Path) ElseIf Left(Subfolder.Path,27) = "C:\Documents and Settings\9" Then FSO.DeleteFolder(Subfolder.Path) End If Next End Sub Essentially this compares the folder path against the text on the right and deletes the folder if it matches- so 9teststudent would be deleted but jenkins (staff) would not. Obviously change this to 2009 or 99 as your convention dictates. Note that this does have to be updated every year but allows extremely granular control over profiles to be deleted. (Run as a shutdown script)
pwds Posted February 4, 2010 Posted February 4, 2010 Although the script worked in initial testing I have had problems rolling it out to users and decided to use Delprof to achieve this- limited to the library and computer suites. Teacher profiles will be deleted but not on their primary workstations.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now