Disk Check

Hi Experts,

I need a script i can run that will perform a dskchk on the C: drive and restart the machine. Thus far I have had no success in getting one working!

Look forward to reading your feedback.
isdd2000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cvargasjCommented:
Hi,

You need make to script .BAT with next sentences:

Chkdsk c:
shutdown /r /d p:0:0
0
isdd2000Author Commented:
Hi,

Do they need to be 2 separate scripts, because I just saved the above into a batch file and it did not work.

Thanks for the feedback!
0
cvargasjCommented:
Why dont work???

What's the error?
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

isdd2000Author Commented:
there is no error, it just continually runs dskchk c:

See attached
Capture.JPG
0
suman_g4Commented:
Save the below commands in a .bat file and run the .bat file from an elevated command prompt..

ECHO Y|CHKDSK C: /F /X
SHUTDOWN /R /F

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cvargasjCommented:
Ok,

Change the name of file .bat
0
isdd2000Author Commented:
Please check the screenshot provided the file name is chkdsk.bat
0
cvargasjCommented:
Ok,

I checked the screenshot, by thats I reply that you needs rename the chkdsk.bat by other filename
0
isdd2000Author Commented:
Hi cvargasj,

I do not understand what you would like me to do. What do I need to rename the chkdsk.bat to?
0
suman_g4Commented:
Hi ISDD,

Did you got a chance to execute the below commands? Just put the below 2 lines in a .bat file and run it from an elevated command prompt..

ECHO Y|CHKDSK C: /F /X
SHUTDOWN /R /F

Let us know if the .bat file works for you..
0
cvargasjCommented:
the .bat that you created have the name CHKDSK.bat and CHKDSK is the operating system' command name.

You can rename the filename "chkdsk.bat" by "myscript.bat"
0
Rob MinersCommented:
Reg add worked on Windows 8, I can't test it in your environment though.

run from an Elevated prompt .


@echo off

REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" /v BootExecute /t REG_MULTI_SZ /d "autocheck autochk /p \??\C:"\0"autocheck autochk *" /f

shutdown /r /c "Reboot to use chkdsk." /f /d P:2:2

ref# http://www.sophos.com/en-us/support/knowledgebase/113908.aspx
0
isdd2000Author Commented:
Hi Guys,

suman_g4's script worked, however i need to configure it so it runs in elevated command prompt on its own.

Any ideas?

This is so my schedule scripting software can run this script on any machine and it just works. Changing the properties of the file to run as administrator will not solve the issue.
0
suman_g4Commented:
Please check the below blog.. It might help you to run in an elevated prompt..

http://blogs.technet.com/b/elevationpowertoys/archive/2010/06/20/creating-a-self-elevating-script.aspx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.