I want to delete old user profile (old more than one day ) ,
Please tell me the bat file command to delete these profiles......
thanks,,
vijay
Seems a dangerous thing to do, like running around with a few razor blades
in your hands. Still - it's your machine. Remember to unwrapped wrapped
lines, to remove the line numbers, to set the exclusions and to test it from
a Console screen before activating it. To make this tool fully active you
must change this line
[20] %VB% 'oFSO.DeleteFolder(oFolder.Path)
like so:
[20] %VB% oFSO.DeleteFolder(oFolder.Path)
Note: When you use this tool, all responsibility lies with you.
[01] @echo off
[02] set Active=false
[03] set Exclusions=/Administrator/LocalService/NetworkService/Default User/
[04] set Scr=c:\TempVBS.vbs
[05] set VB=echo^>^>%Scr%
[06] cd 1>nul 2>%Scr%
[07]
[08] %VB% Set oFSO = CreateObject("Scripting.FileSystemObject")
[09] %VB% Set oWshShell = CreateObject("WScript.Shell")
[10] %VB% sProfiles =
oWshShell.ExpandEnvironmentStrings("%AllUsersProfile%\..")
[11] %VB% sProfiles = oFSO.GetAbsolutePathName(sProfiles)
[12] %VB% For Each oFolder In oFSO.GetFolder(sProfiles).SubFolders
[13] %VB% If InStr(1, "%Exclusions%", "/" ^& oFolder.Name ^& "/", 1) = 0
Then
[14] %VB% If oFSO.FileExists(oFolder.Path ^& "\ntuser.dat") Then
[15] %VB% dFileDate = oFSO.GetFile(oFolder.Path ^&
"\ntuser.dat").DateLastModified
[16] %VB% If DateDiff("d", dFileDate, Date()) ^> 1 Then
[17] %VB% WScript.Echo "Deleting", oFolder.Path
[18] %VB% If %Active% Then
[19] %VB% On Error Resume Next
[20] %VB% 'oFSO.DeleteFolder(oFolder.Path)
[21] %VB% if err.number ^> 0 then WScript.Echo Err.Description
[22] %VB% On Error Goto 0
[23] %VB% End If
[24] %VB% End If
[25] %VB% End If
[26] %VB% End If
[27] %VB% Next
[28] cscript //nologo %Scr%
[29] del %Scr%
Why not use the Microsoft service to delete redundant profiles?
==============
What about the owner profile, Pergasus? Not in your default exclusions
--
SPAMCOP User
"Pegasus [MVP]" <ne...@microsoft.com> wrote in message
news:OHnqIyQb...@TK2MSFTNGP02.phx.gbl...
That's why I wrote "Remember to [..] set the exclusions". If the OP wants to
use such a dangerous tool then he must have the sense
a) To set his own exclusions, and
b) To fully test the script before activating it.
"Pegasus [MVP]" wrote:
> .
>
[20] %VB% 'oFSO.DeleteFolder(oFolder.Path)
[20] %VB% oFSO.DeleteFolder(oFolder.Path)
)
"Vijay" <Vi...@discussions.microsoft.com> wrote in message
news:1751D3FE-3FCB-43FC...@microsoft.com...
"Willard" <gu...@msn.invalid> wrote in message
news:eUyaMZqb...@TK2MSFTNGP04.phx.gbl...