G
Guest
I would like to be able to run the disk cleanup utility, defrag, and restart
our computers overnight using free tools, while the computer is logged off. I
am having trouble getting this to run properly (called from a scheduled task,
with a domain admin account for authentication) on logged off Windows 2000
computers, I have not fully tested this on XP. It seems to run correctly when
it is logged on, but they do not run when the machine is logged off. Has
anyone else gotten this to work? How would I do this? Thank you in advance
for your help!
1] I wrote two scripts, one for windows 2000, and another for windows xp:
---------{snip}------------------
rem "MaintXP.bat"
rem Windows XP script
regedit /s c:\scripts\cleanmgr.reg
cleanmgr.exe /sagerun:1
defrag C: -f
C:\scripts\shutdown.exe /R /T:2
---------{/snip}-----------------
---------{snip}------------------
rem "Maint2k.bat"
rem Windows 2000 script
regedit /s c:\scripts\cleanmgr.reg
cleanmgr.exe /sagerun:1
C:\scripts\AutoDeFrag.exe
C:\scripts\shutdown.exe /R /T:2
---------{/snip}-----------------
2] I downloaded two files:
1) Shutdown.exe: From the Windows 2000 Resource Kit, can be downloaded here
http://www.petri.co.il/download_free_reskit_tools.htm
2) Autodefrag.exe:
http://www.morphasys.com/autodefrag/
3] I created a cleanmgr.reg file that will configure the registry for the
Disk Cleanup Wizard
---------{snip}------------------------------------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Content Indexer Cleaner]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Pages Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Offline Files]
"StateFlags0001"=dword:0000000
------------{/snip}-------------------------------------------------------------------------
4] I drop all of these files into C:\scripts directory, and set a scheduled
task to run the respective batch file (depending on what OS it is) at night
when the computer is logged off.
our computers overnight using free tools, while the computer is logged off. I
am having trouble getting this to run properly (called from a scheduled task,
with a domain admin account for authentication) on logged off Windows 2000
computers, I have not fully tested this on XP. It seems to run correctly when
it is logged on, but they do not run when the machine is logged off. Has
anyone else gotten this to work? How would I do this? Thank you in advance
for your help!
1] I wrote two scripts, one for windows 2000, and another for windows xp:
---------{snip}------------------
rem "MaintXP.bat"
rem Windows XP script
regedit /s c:\scripts\cleanmgr.reg
cleanmgr.exe /sagerun:1
defrag C: -f
C:\scripts\shutdown.exe /R /T:2
---------{/snip}-----------------
---------{snip}------------------
rem "Maint2k.bat"
rem Windows 2000 script
regedit /s c:\scripts\cleanmgr.reg
cleanmgr.exe /sagerun:1
C:\scripts\AutoDeFrag.exe
C:\scripts\shutdown.exe /R /T:2
---------{/snip}-----------------
2] I downloaded two files:
1) Shutdown.exe: From the Windows 2000 Resource Kit, can be downloaded here
http://www.petri.co.il/download_free_reskit_tools.htm
2) Autodefrag.exe:
http://www.morphasys.com/autodefrag/
3] I created a cleanmgr.reg file that will configure the registry for the
Disk Cleanup Wizard
---------{snip}------------------------------------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Content Indexer Cleaner]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Pages Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files]
"StateFlags0001"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Offline Files]
"StateFlags0001"=dword:0000000
------------{/snip}-------------------------------------------------------------------------
4] I drop all of these files into C:\scripts directory, and set a scheduled
task to run the respective batch file (depending on what OS it is) at night
when the computer is logged off.