On 10 May 2010 at 9:31, Oliver Marshall wrote: > Hi chaps,. Does anyone know of a way that we can remotely force a > workstation to run a full chkdsk on the next reboot? We have a variety of > remote tools which can run scripts and edit this and that, but the issue we > have is that we can't initiate "chkdsk c: /f" remotely as the script sits > there wanting someone to press Y to tell it to run on the next reboot. Is > there a way we can, perhaps, edit the boot files directly to tell them run a > chkdsk c: /f? CHKDSK itself must be editing something to have it run at next > reboot and I'm hoping we can edit this directly. Olly
After a little Googling for "force chkdsk next reboot", I found this MSKB: CHKNTFS.EXE: What You Can Use It For http://support.microsoft.com/kb/160963 Reading this, I found that running "chkdsk C: /f/r" and answering YES changes the contents of this registry key: HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\Session Manager I dumped this key then ran "chkdsk C: /f/r", answering YES, and here's what I got: Before: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] "BootExecute"=hex(7):61,00,75,00,74,00,6f,00,63,00,68,00,65,00,63,00,6b,00,20,\ 00,61,00,75,00,74,00,6f,00,63,00,68,00,6b,00,20,00,2a,00,00,00,00,00 which resolves to "autocheck autochk *" After: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] "BootExecute"=hex(7):61,00,75,00,74,00,6f,00,63,00,68,00,65,00,63,00,6b,00,20,\ 00,61,00,75,00,74,00,6f,00,63,00,68,00,6b,00,20,00,2f,00,72,00,20,00,5c,00,\ 3f,00,3f,00,5c,00,43,00,3a,00,00,00,61,00,75,00,74,00,6f,00,63,00,68,00,65,\ 00,63,00,6b,00,20,00,61,00,75,00,74,00,6f,00,63,00,68,00,6b,00,20,00,2a,00,\ 00,00,00,00 which resolves to "autocheck autochk /r \??\C: autocheck autochk *" I created both ChkdskON.reg and ChkdskOFF.reg from these keys, and they work to toggle the BootExecute key. I imagine you could write some VBS which would insert this registry key remotely. If you do, please share! Angus PS I also found a batch file that might help. The lines starting with "reg ADD" and ending with "/f" are actually one long line: ============= Included Stuff Follows ============= @echo off chkdsk.exe c: if ERRORLEVEL 2 goto ADD_CHECK echo. echo The drive is okay this time. goto end :ADD_CHECK reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v BootExecute /t REG_MULTI_SZ /d "autocheck autochk /p \??\C:\0autocheck autochk *" /f echo. echo The drive has problems and chkdsk will run next boot :end ============= Included Stuff Ends ============= Seen here: http://www.pcreview.co.uk/forums/thread-3790839.php -- Angus Scott-Fleming GeoApps, Tucson, Arizona 1-520-895-3270 Security Blog: http://geoapps.com/ ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
