Wednesday, August 6, 2008

[THIN] Re: Delete Local Profiles

Angela,

 

This is a .vbs script that’d remove the profiles

 

                On error resume next

                Set objFSO = CreateObject("Scripting.FilesystemObject")

                set ObjFolder=objFSO.GetFolder("C:\Documents and Settings")

               

                set colSubFolders = objFolder.Subfolders

               

                strCurrentProfile = LCase(objShell.ExpandEnvironmentStrings("%USERPROFILE%"))

               

                For Each objSubfolder In ColSubFolders

                                                               

                                if objsubfolder.name <> "Default User" AND _

                                   objsubfolder.name <> "All Users" AND _

                                   objsubfolder.name <> "LocalService" AND _

                                   objsubfolder.name <> "NetworkService" AND _

                                   objsubfolder.name <> "administrator" AND _

                                   objsubfolder.name <> "Ctx_SmaUser"

                               

                                                fname= lcase("c:\documents and settings\" & objsubfolder.name)

                                                If fname <> strCurrentProfile Then

                                                                wscript.echo "Remove:" & fname

                                                               

                                                                Err.Clear

                                                                objFSO.DeleteFolder fname,True

                                                               

                                                                If Err.Number > 0 Then

                                                                                Wscript.echo (" Delete failed - error: " & Err.description  

                                                                End If

                                                               

                                                End If

                                               

                                End If   

                Next

 

From: thin-bounce@freelists.org [mailto:thin-bounce@freelists.org] On Behalf Of Angela Smith
Sent: 06 August 2008 08:22
To: thin@freelists.org
Subject: [THIN] Delete Local Profiles

 

Hi

We are removing roaming profiles from our organisation as we don't really need them anymore.  We will use local profiles only on Windows 2003 systems.  I want to setup a scheduled task on each server that deletes all local profiles except Administrator, All Users and Default User.  AD Group Policy only has a setting to delete cached roaming profiles, not local profiles.

I know there are utilities such as delprof and remprof but I dont believe there is an easy way to say delete all except Administrator etc.  Has anyone achieved this or know of an easy way to do this?

Thanks
Angela


to the movies Shout your Messenger buddies

No comments: