Share via


How to run ChkDsk during OSD ?

Question

Tuesday, October 15, 2013 4:23 PM

I have in my TS a step if the Apply OS step fails to run ChkDsk. Maybe I'm missing something here because it seems to not work correctly.

It would be in WinPE when it tries to run ChkDsk.

Command line: 

cmd.exe /c CHKDSK "C:" /F /R /X (I'm not sure this is the correct syntax)

or

cmd.exe /c CHKDSK "C:" /R   (This option seems to work but on successful run it exits with an exit code 1 which triggers a fail in the TS)

 Anyone have experience with this as to which should be the correct command line options to run from the WinPE stage during OSD ?

The purpose is to correct any bad issues on the hard drive before a retry of applying the OS. I ran into this problem yesterday where the Apply OS step failed because of some bad sectors on drive.

Thanks for any helpful input on running ChkDsk during OSD

All replies (7)

Wednesday, October 16, 2013 6:51 PM ✅Answered

Thanks for both of the suggestions.

I think I will go with cmd.exe /c CHKDSK "C:" /R and then handle the error code as suggested

I think that cmd.exe /c CHKDSK "C:" /F /R /X may need a restart to actually run chkdsk after this command.


Tuesday, October 29, 2013 8:11 PM ✅Answered

Yes, I used the /R option and basically for now I chose to ignore the error. The above suggestions would work as it does handle the exit code properly. The chkdsk only runs in my TS when the first "Apply OS" fails which would mean in most cases there's errors on disk. Then chkdsk runs followed by a second attempt to apply OS.

chkdsk is running from WinPE with this command line:

cmd.exe /c x:\windows\system32\chkdsk c: /R

In my testing I monitor the SMSTS.log file as chkdsk is running because it does take quite a while.

Thanks for the suggestions and tips.


Wednesday, October 16, 2013 5:49 PM

no one has done this before during OSD ?


Wednesday, October 16, 2013 6:15 PM | 1 vote

Never done this, but you could use a batch to kick off chkdsk. This should contain something like "if %errorlevel%==1 exit 0" (or whatever the exact syntax might be). Alternative: use a run command line step. It lets you define expected return codes.

Torsten Meringer | http://www.mssccmfaq.de


Wednesday, October 16, 2013 6:16 PM | 1 vote

Hi,

personally I've never used checkdisk in a TS. But as you said, the only Problem is the return code.
Have you tried to run the command within a small Batch file, and set the error Level to 0, so SCCM would see an Exit code 0?

set errorlevel=0 

Monday, October 28, 2013 11:30 AM

Hi,

Did this solution work?

Best Regards,

Joyce Li

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place.


Wednesday, October 30, 2013 1:15 AM

Hi,

Thank you for your reply, I'll mark it as answer.

Best Regards,

Joyce Li

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place.