PC Review


Reply
Thread Tools Rate Thread

Delete old profiles

 
 
Vijay
Guest
Posts: n/a
 
      1st Oct 2009
I want to delete old profile automatically from document and settings more
than 10 days , Old profile should be deleted automatically,
Should i use group policy or need to run bat files,

Please tell me the steps,
 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      1st Oct 2009

"Vijay" <(E-Mail Removed)> wrote in message
news:C46CF8D3-78C8-41AA-8303-(E-Mail Removed)...
>I want to delete old profile automatically from document and settings more
> than 10 days , Old profile should be deleted automatically,
> Should i use group policy or need to run bat files,
>
> Please tell me the steps,


Here you go:
1. Copy & paste the code below into c:\Windows\DeleteFolders.vbs.
2. Unwrap any line that might have wrapped around.
3. Adjust Lines 01 and 02 to suit your environment.
4. Remove the line numbers.
5. Double-click c:\Windows\DeleteFolders.vbs. Note that the code
will prompt you before it deletes a profile folder.

[01] iAge = 10
[02] sExceptions = "Default User|Administrator|All
Users|LocalService|NetworkService"
[03] Set oFSO = CreateObject("Scripting.FileSystemObject")
[04] Set oProfiles = oFSO.GetFolder("c:\Documents and Settings")
[05]
[06] For Each oFolder In oProfiles.SubFolders
[07] If InStr(1, sExceptions, oFolder.Name, 1) = 0 Then
[08] If oFSO.FileExists(oFolder.Path & "\ntuser.dat") Then
[09] Set oFile = oFSO.GetFile(oFolder.Path & "\ntuser.dat")
[10] If DateDiff("d", oFile.DateLastModified, Now) > iAge Then
[11] iReply = MsgBox("Delete " & oFolder.Path & "?", vbYesNo)
[12] if iReply = 6 then oFSO.DeleteFolder oFolder.Path
[13] End If
[14] End If
[15] End If
[16] Next


 
Reply With Quote
 
SPAMCOP User
Guest
Posts: n/a
 
      1st Oct 2009

Delprof is a Microsoft utility from the 2003 Resource Kit:

http://download.microsoft.com/downlo...27/delprof.msi

How to use the above tool (writen for Windows 2000 but will give you an
idea):

http://support.microsoft.com/kb/315411


Use the Profile Cleanup Service from Microsoft

http://download.microsoft.com/downlo...lean-Setup.msi

--
SPAMCOP User


"Vijay" <(E-Mail Removed)> wrote in message
news:C46CF8D3-78C8-41AA-8303-(E-Mail Removed)...
>I want to delete old profile automatically from document and settings more
> than 10 days , Old profile should be deleted automatically,
> Should i use group policy or need to run bat files,
>
> Please tell me the steps,


 
Reply With Quote
 
SPAMCOP User
Guest
Posts: n/a
 
      1st Oct 2009
Pegasus,

If you include a MessageBox then it isn't unattended

Good ole FileSystemObject from the scrun dll. Takes me back to VB6 days -
happy times )

--
SPAMCOP User

"Pegasus [MVP]" <(E-Mail Removed)> wrote in message
news:%23yhl%(E-Mail Removed)...
>
> "Vijay" <(E-Mail Removed)> wrote in message
> news:C46CF8D3-78C8-41AA-8303-(E-Mail Removed)...
>>I want to delete old profile automatically from document and settings more
>> than 10 days , Old profile should be deleted automatically,
>> Should i use group policy or need to run bat files,
>>
>> Please tell me the steps,

>
> Here you go:
> 1. Copy & paste the code below into c:\Windows\DeleteFolders.vbs.
> 2. Unwrap any line that might have wrapped around.
> 3. Adjust Lines 01 and 02 to suit your environment.
> 4. Remove the line numbers.
> 5. Double-click c:\Windows\DeleteFolders.vbs. Note that the code
> will prompt you before it deletes a profile folder.
>
> [01] iAge = 10
> [02] sExceptions = "Default User|Administrator|All
> Users|LocalService|NetworkService"
> [03] Set oFSO = CreateObject("Scripting.FileSystemObject")
> [04] Set oProfiles = oFSO.GetFolder("c:\Documents and Settings")
> [05]
> [06] For Each oFolder In oProfiles.SubFolders
> [07] If InStr(1, sExceptions, oFolder.Name, 1) = 0 Then
> [08] If oFSO.FileExists(oFolder.Path & "\ntuser.dat") Then
> [09] Set oFile = oFSO.GetFile(oFolder.Path & "\ntuser.dat")
> [10] If DateDiff("d", oFile.DateLastModified, Now) > iAge Then
> [11] iReply = MsgBox("Delete " & oFolder.Path & "?", vbYesNo)
> [12] if iReply = 6 then oFSO.DeleteFolder oFolder.Path
> [13] End If
> [14] End If
> [15] End If
> [16] Next
>
>


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      1st Oct 2009

"SPAMCOP User" <spamcop_user@no_mail.haha> wrote in message
news:(E-Mail Removed)...
> Pegasus,
>
> If you include a MessageBox then it isn't unattended
>
> Good ole FileSystemObject from the scrun dll. Takes me back to VB6 days -
> happy times )
>
> --
> SPAMCOP User


I know but I'm very reluctant to post a solution that deletes folders
without user confirmation. It would be quite easy to remove the user prompt
but then your "delprof" suggestion may be a more elegant solution.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete profiles christie Windows Vista Administration 0 3rd Jan 2008 09:50 PM
which profiles can I delete? =?Utf-8?B?U3RhcnZveWFnZXI=?= Windows XP General 2 2nd Dec 2006 10:44 PM
Delete cached profiles =?Utf-8?B?c2FsZWVu?= Microsoft Windows 2000 Terminal Server Applications 3 16th Feb 2006 01:05 PM
How do I delete profiles? John Microsoft Windows 2000 Active Directory 1 4th Jun 2004 10:07 PM
Can't delete profiles Christian Microsoft Windows 2000 Security 2 9th Mar 2004 07:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:10 AM.