Requests for Automation

Agent procedure chkdsk on multiple drives

I am creating this request on behalf of our customer Derek. There is an Agent procedure that comes with the maintenance pack that will check all disks inside of a machine be it a server - endpoint ect.. the problem with this procedure is that it will forcibly dismount drives that are not the system volume. We would like a procedure created that will schedule this operation on the next reboot as oppose to running it right then and dismounting the drives which is potentially hazardous to databases and file servers.

Gravatar for Douglas Sanchez
Douglas Sanchez over 3 years ago

I spent a couple of days working on a new procedure for this request, after some extensive research, it does not seem possible to schedule a disk check for all drives during the computer's boot sequence. It is only available for the drive hosting the OS (Usually the C Drive) as it cannot be unmounted during use to perform a disk check. Any other form of Disk Check native to Windows require all the other disks to be offline (unmounted) during the check and then re mounted.

Gravatar for Derek Wells
Derek Wells over 3 years ago

Doug, are you available to schedule a call with me today or tomorrow? If today or tomorrow doesn't work for you, how about next week?

Gravatar for Saul Ansbacher
Saul Ansbacher over 3 years ago

You just need to set the BootExecute / "autocheck autochk" reg key with the drives you want to check and then reboot. Look at:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager and the BootExecute Value
I have a VBScript that does that, I could probably wrap it in a Kaseya Script. Even lets you exclude certain drives (eg. Temp/Swap drives) and specify a regular or Full chkdsk.

Gravatar for Brent Wagner
Brent Wagner almost 3 years ago

Here's one I wrote that works. Be warned: it offlines iSCSI briefly so it'll be skipped, FYI.

The important bits are two powershell commands:
GET-WMIOBJECT –class win32_logicaldisk | where {$_.DriveType -eq 3} | foreach {fsutil dirty set $_.DeviceID}
GET-WMIOBJECT –class win32_logicaldisk | where {$_.DriveType -eq 3} | foreach {chkntfs /c $_.DeviceID}

...then reboot.



  • 0 Votes
  • Open for over 3 years
  • Created by David