scriptomatic
Technical User
I'm looking for a way to run chkdsk and defrag on the Windows 2000 and WinXP workstations in my Windows 2003 domain.
I'd like to run them as either Logoff or Shutdown scripts in Active Directory. If it's a logoff script, a shutdown command would be included in the script.
And what I'd really like is to run the chkdsk command only a couple days a week and the defrag would run at logoff or shutdown only if that occured after 3pm in case someone reboots earlier in the day.
I previously ran a chkdsk batch file as a scheduled task, but that requires a user with a consistent password and defrag won't work without admin privileges (and defrag.exe won't work at all in W2k).
I believe no elevated privileges are required if the script runs from AD.
Here's my chkdsk.bat file:
-----------------------------------------------------------
@echo off
echo %date% %time% Start of chkdsk operation >> c:\chkdsk.log
echo Y|%SystemRoot%\system32\chkdsk.exe /f c: 1>>c:\chkdsk.log 2>&1
echo %date% %time% End of chkdsk operation >> c:\chkdsk.log
echo. ----------------------- >> c:\chkdsk.log
-----------------------------------------------------------
I'm not sure if it' possible to simply call this from a VBScript, and I'm not sure how to test for times and dates.
I realize I have a lot here, so I'll say thanks in advance for any pieces anyone has to offer -- or any places you can point me to.
I'd like to run them as either Logoff or Shutdown scripts in Active Directory. If it's a logoff script, a shutdown command would be included in the script.
And what I'd really like is to run the chkdsk command only a couple days a week and the defrag would run at logoff or shutdown only if that occured after 3pm in case someone reboots earlier in the day.
I previously ran a chkdsk batch file as a scheduled task, but that requires a user with a consistent password and defrag won't work without admin privileges (and defrag.exe won't work at all in W2k).
I believe no elevated privileges are required if the script runs from AD.
Here's my chkdsk.bat file:
-----------------------------------------------------------
@echo off
echo %date% %time% Start of chkdsk operation >> c:\chkdsk.log
echo Y|%SystemRoot%\system32\chkdsk.exe /f c: 1>>c:\chkdsk.log 2>&1
echo %date% %time% End of chkdsk operation >> c:\chkdsk.log
echo. ----------------------- >> c:\chkdsk.log
-----------------------------------------------------------
I'm not sure if it' possible to simply call this from a VBScript, and I'm not sure how to test for times and dates.
I realize I have a lot here, so I'll say thanks in advance for any pieces anyone has to offer -- or any places you can point me to.