Sign in to follow this  
Followers 0
chiners_68

Best way to complete the following task..

4 posts in this topic

Hi Guys,

i need some assistance on the best way to do the job below with autoit.

basically I want to delete all the profiles on an XP machine but keep the Default user/ all user & logged in users profile.

what would be the best way to do this..?

Share this post


Link to post
Share on other sites



Hi Guys,

i need some assistance on the best way to do the job below with autoit.

basically I want to delete all the profiles on an XP machine but keep the Default user/ all user & logged in users profile.

what would be the best way to do this..?

Not sure if that's the best way but i guess it will work ;P Before replacing MsgBox with DirRemove THINK/TEST etc ;p i am not responsible for your losses ;p

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("C:\Documents and Settings")
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
;_ArrayDisplay($FileList,"$FileList")

For $i = 1 To $Filelist[0]
    
    If $Filelist[$i] = "All Users" OR $Filelist[$i] = "Default User" OR $Filelist[$i] = @UserName OR $Filelist[$i] = "LocalService" OR $Filelist[$i] = "NetworkService" Then
        ; Do nothing here 
    Else
        
        If MsgBox(1, "Are you sure?", "Dir for user " & $Filelist[$i] & " is about to be deleted..") = 1 Then
            
            
            ; Add deletion command here, replace MsgBox with DirRemove. SHould work
            MsgBox(0,"test","C:\Documents and Settings\" & $Filelist[$i])
            ;DirRemove("C:\Documents and Settings\" & $Filelist[$i],1)
            
        EndIf
    EndIf
Next

My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

Also have a look at this registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

Share this post


Link to post
Share on other sites

cheers guys for your help... ive found a tool which microsoft has DelProf.exe which removes profiles doing the job I wanted. /q command dosent seem to work but ive got round this with Autoit by piping the y & enter..

cheers

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0