You could skin it a different way and use WMI:
strComputer = "." objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\" + strComputer +"\root\cimv2") objDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='D:'") errReturn = objDisk.ChkDsk(.f.) && or .t. to fix errors ? errReturn
I believe the return codes etc are as described here: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/vdswmi/c...