WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Win7

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Run Chkdsk at Start Up

 Keywords: Run Chkdsk at Start Up Run RunOnce AsInvoker

Question:

In WinBatch, I want to run the chkdsk command at Windows Start up on Windows 7. I am logged in as admin and when I run a compiled script with the manufest settings AsInvoker I get an access denied error message in the cmd window.
Run("cmd.exe", "/k echo n | chkdsk c: /f /r")

Answer:

You are getting the Access Denied because the ChkDsk command needs to be run as the Admin. When you specify AsInvoker and running under an Admin account, you are actually running as a Standard user. In order to elevate to the full Admin you must compile the script using HighestAvilable or RequireAdmin manifest setting.

Unfortunately elevated processes (manifested as HighestAvailable[when logged in as admin] or RequireAdmin) are BLOCKED by Windows when running in the Windows Start up. Reference: http://msdn.microsoft.com/en-us/library/bb325654.aspx

Since this is a process that you want to run on a schedule, have you considered setting up a weekly Scheduled Task ( using the local System account ) to handle this?


Article ID:   W18439
Filename:   Run Chkdsk at Start Up.txt
File Created: 2014:02:19:12:15:42
Last Updated: 2014:02:19:12:15:42