[Kaseya Agent Procedure] – Run CHKDSK And Repair If Needed.

On October 18, 2011, in Projects, Scripting, by Cubert aka (Cube Dweller)

Free Kaseya Script – Run CHKDSK And Repair

Here is another free script from Cubert’s Dwelling, An Agent procedure that will run a CHKDSK in read only mode. Parse the output and run a chkdsk /F if it meets the criteria set forth in the script. It then emails an alert with the scan results to a email address provided before it uploads a copy of the scan to the get file for storage and review. Finally it updates 2 custom fields in the system info table with a brief result and the last run time. If it finds the disk healthy it will report as such if not it will report one of several error types.

Download Script Here

You will need to unzip the script and import it into Kaseya. Once imported edit the script and find the 2 places it email out and update the email address(es), Then you will need to add the 2 custom fields into your System-info table.

To add the custom fields:
1#  Open Kaseya and go to [Audit] – [View Individual Data] – [System Information] and select the button marked [New Custom Field]

2# The next box that pops up will create a new field, We will need to add 2 fields the first is CheckDisk Status and it will be a type String and Check Disk Updated with a type String.

Now run your disk check and see what it shows. If it meets with the right disk errors, a  repair is sent to the system and a email to you to reboot system when you can so the repair can complete. You can add another execute command under where we call the chkdsk /F with a shutdown -r -t 3 and that will cause the system to reboot its self after issuing the fix cmd. This is great for servers where your scheduling the disk scans during maintenance cycles but not so good with workstations where user gets booted up then a scan runs that then reboots the system will only inflame your users. So be mindful of how you use a shutdown cmd.


Cubert 🙂

Tagged with:

7 Responses to “[Kaseya Agent Procedure] – Run CHKDSK And Repair If Needed.”

  1. Mike says:

    very good proactive script – well done.

  2. Matt says:

    where’s the download? got a 404 error

  3. Matt, not sure why link stopped working, I reviewed the post and edited the link and now the zip file is available again.


  4. Elliot says:

    any reason you dont automatically run the repair for this error “Chkdsk maybe reporting errors when no errors present?”

  5. I have found that doing a manual scan shows different results more often then not so, I stopped the forced running of the /F on that error.

    The idea is you know about the errors and look in to it.

  6. Greg says:

    We’ve noticed that IF the error log contains “Errors found. CHKDSK cannot continue in read-only mode.” and it does NOT also contain the string “Windows found problems with the file system.”, then it won’t report as bad.

  7. Greg says:

    Subbing here for followup

Leave a Reply