|
| | |||||||
| Windows XP Discuss the Microsoft Windows XP Operating System |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| delete old profile through bat file hi, 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 |
| |
|
#2
| |||
| |||
| Re: delete old profile through bat file "Vijay" <Vijay@discussions.microsoft.com> wrote in message news:2EC94E27-213A-4859-8AB7-EB7DA490A93B@microsoft.com... > hi, > > 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("%AllUsersProfi le%\..") [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% |
|
#3
| |||
| |||
| Re: delete old profile through bat file Op, 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]" <news@microsoft.com> wrote in message news:OHnqIyQbKHA.5544@TK2MSFTNGP02.phx.gbl... > > "Vijay" <Vijay@discussions.microsoft.com> wrote in message > news:2EC94E27-213A-4859-8AB7-EB7DA490A93B@microsoft.com... >> hi, >> >> 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("%AllUsersProfi le%\..") > [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% > > |
|
#4
| |||
| |||
| Re: delete old profile through bat file "SPAMCOP User" <spamcop_user@no_mail.haha> wrote in message news:%23959nFWbKHA.4044@TK2MSFTNGP06.phx.gbl... > Op, > > Why not use the Microsoft service to delete redundant profiles? > > ============== > > What about the owner profile, Pergasus? Not in your default exclusions > > -- > SPAMCOP User 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. |
|
#5
| |||
| |||
| Re: delete old profile through bat file Please tell me the bat command only, i think you described with help of vb, "Pegasus [MVP]" wrote: > > "SPAMCOP User" <spamcop_user@no_mail.haha> wrote in message > news:%23959nFWbKHA.4044@TK2MSFTNGP06.phx.gbl... > > Op, > > > > Why not use the Microsoft service to delete redundant profiles? > > > > ============== > > > > What about the owner profile, Pergasus? Not in your default exclusions > > > > -- > > SPAMCOP User > > 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. > > > . > |
|
#6
| |||
| |||
| Re: delete old profile through bat file I did give you a batch file. While there is a VB Script file embedded in it, this is irrelevant. Just leave it as it is (with the exception of these lines: [20] %VB% 'oFSO.DeleteFolder(oFolder.Path) [20] %VB% oFSO.DeleteFolder(oFolder.Path) ) "Vijay" <Vijay@discussions.microsoft.com> wrote in message news:1751D3FE-3FCB-43FC-A2C4-DFF03CDBB701@microsoft.com... > Please tell me the bat command only, i think you described with help of > vb, > > "Pegasus [MVP]" wrote: > >> >> "SPAMCOP User" <spamcop_user@no_mail.haha> wrote in message >> news:%23959nFWbKHA.4044@TK2MSFTNGP06.phx.gbl... >> > Op, >> > >> > Why not use the Microsoft service to delete redundant profiles? >> > >> > ============== >> > >> > What about the owner profile, Pergasus? Not in your default exclusions >> > >> > -- >> > SPAMCOP User >> >> 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. >> >> >> . >> |
|
#7
| |||
| |||
| Re: delete old profile through bat file What is the "Microsoft Service" and where do you find lt ?? SPAMCOP User wrote: > Op, > > Why not use the Microsoft service to delete redundant profiles? > > ============== > > What about the owner profile, Pergasus? Not in your default exclusions > > |
|
#8
| |||
| |||
| Re: delete old profile through bat file It's not a "Microsoft Service" that Spamcop was thinking about but rather the "User Profile Deletion Utility" (Delprof.exe) - see here: http://www.microsoft.com/downloads/d...displaylang=en "Willard" <guess@msn.invalid> wrote in message news:eUyaMZqbKHA.6028@TK2MSFTNGP04.phx.gbl... > What is the "Microsoft Service" and where do you find lt ?? > > SPAMCOP User wrote: >> Op, >> >> Why not use the Microsoft service to delete redundant profiles? >> >> ============== >> >> What about the owner profile, Pergasus? Not in your default exclusions >> >> |
| Bookmarks |
| Thread Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cannot delete old local profile from XP domain system | Sandy Wood | Windows XP | 4 | 10-17-2008 04:03 AM |
| How to delete a profile in XP SP2 | Robert | Windows XP | 3 | 03-24-2008 07:40 AM |
| How to Delete a Profile | xwdpuzzler | Windows XP | 0 | 12-04-2007 08:40 PM |
| Delete default network profile | QT | Pocket PC General | 0 | 03-29-2007 01:30 AM |
| auto delete profile logoff | doghunt | Windows XP | 1 | 01-17-2007 04:45 AM |
| New To Technology Questions? | Do You Need Help with Your Computer or Device? | Do You Need Help with this site? |