How do you prevent a user aborting a scheduled disk check?

chriscomputerguy
chriscomputerguy used Ask the Experts™
on
Hi everyone.
I was wondering how you can prevent a user from aborting a disk check scheduled using chkdsk /f on reboot.
Is this possible?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
It is a command based routine that is designed to be stopped by the user. So short of changing the program, no, there is no way to prevent it.

In most cases, educating the user will work. It is, after all, for their benefit ultimately. So if a given user won't do it, then do it for them and move on.

Also, chkdisk does not need to be run daily, so please do not set it up as a daily startup task.

... Thinkpads_User
Did you try to submit the «chkdsk /f» COMMAND from a visual basic script language?
Would you like to try?
May I do the script to you?


@Thinkpads_User,
I would like to hear from you. Thanks in advance.


JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
>>> I would like to hear from you.

I was responding about the command as stated, not about embedding it in another program.

... Thinkpads_User
Thinkpads_User,
Thank you very much.
Excellent.

Author

Commented:
hmmm...i use PSEXEC in a workplace environment to start the chkdsk remotely.
is there a better way to do it?
>> is there a better way to do it?
There is another way. We may write a shot VBScript, instead.
I guess this will prevent a user aborting.
You only need to call the VBscript.

Author

Commented:
hmmm
the chkdsk i am talking about is the one that runs on reboot...
[or rather, I run chkdsk /f on the workstation's primary partition, which is locked; therefore it requires it to be run on reboot].
I dont think this vbscript will carry over to pre-boot, will it?

Author

Commented:
even if it's not, i would still be interested in the vbscript!! :D
I will test it and send to you, as soon as possible.
Chris,

It worked fine here.
Please, see the VBScript code and test it before use it in a production environment. OK?

In the production enviroment you just need to use the «CALL "CheckDisk.vbs" statement.»
CheckDisk.vbs
Chris,

Please take a look at http://ss64.com/vb/run.html.

Jorge.

Author

Commented:
when I run it, it freezes with the following output (hidden)
The type of the file system is NTFS.

Chkdsk cannot run because the volume is in use by another
process.  Would you like to schedule this volume to be
checked the next time the system restarts? (Y/N)


1. Did you try to use /x? chkdsk /f/x

a. re-start your OS.
b. submit the chkdsk /f/x at the do very begining





Author

Commented:
the /x command will not have any effect on the primary hdd, c though.

Author

Commented:
Hey, thank you for that. That was very interesting information.
Does chkntfs  with a switch of /t:0 prevent the user from aborting though?
I haven't tested it, but it looks like it does according to the chkntfs /? help and also under the page author's "Remarks" just above the chkntfs "Examples":

"Although you can set the Autochk.exe initiation countdown time to zero, you cannot cancel a potentially time-consuming automatic file check if you set it to zero."

That's what you want, and conversely is what most workstation users would hate.

Author

Commented:
Indeed!!!

Well I shall test this first thing monday morning at work and report back!
Thanks!
In the 2nd of the linked pages (near the top) you will see the effects on the "BootExecute" registry value after running the example chkntfs command.

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager]

Default Values (other than the last write time) in exported Text file from REGEDIT:

Key Name:          HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
Class Name:        <NO CLASS>
Last Write Time:   10/08/2011 - 13:06
Value 0
  Name:            BootExecute
  Type:            REG_MULTI_SZ
  Data:            autocheck autochk *

Example REG QUERY results (\0\0 is new line in a Multi-String value):
reg query "HKLM\system\CurrentControlSet\Control\Session Manager" /v BootExe
cute

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\system\CurrentControlSet\Control\Session Manager
    BootExecute REG_MULTI_SZ    autocheck autochk *\0\0

Default Values in an exported *.REG file:

[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
Whoops, I mentioned "ControlSet001" key in one line above when it should have been "CurrentControlSet".  I mentioned the settings because some AntiVirus applications add a value to a new line in that "BootExecute" value, and I thought I would pre-warn you in case you spotted something else other than the default lines.
BillDL,
I tried.... It didn't even mark it as dirty or do a disk check...
I'm starting to think that it;s just not possible without modifying source code...

Author

Commented:
In the end, I guess this is just not really possible to do without making source code modifications.
But thank you all for the insight and help!
You provided some valuable insights.
Thank you Chris

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial