Page 1 of 1

Script to auto schedule the Memory diagnostics tool

Posted: Wed Sep 03, 2014 5:48 pm
by Fred
Today I had a message from a tech asking if there was any way to use UVK to startup or schedule the Windows Memory Diagnostic program to run on next boot without popping up anything on the screen that the end user would see.

I thought that was an interesting idea, but couldn't find anything in the registry or in the web that could help me to find out how windows performs the schedule.

So I came up with a script that does the job. Actually two scripts. One just performs the schedule, the other one also reboots immediately.

mdsched.uvk : Schedule the Memory Diagnostic scan for the next boot:

Code: Select all

 <Run>
%SystemDir%\MdSched.exe
 <Comment>
->WaitWindow(10)
->WaitControl([CLASS:Button; INSTANCE:2],5)
->ClickControl([CLASS:Button; INSTANCE:2])
->WaitWindowClose()
->WaitWindow(2)
->WaitControl([CLASS:Button; INSTANCE:1],2)
->ClickControl([CLASS:Button; INSTANCE:1])
mdsched2.uvk : Schedule the Memory Diagnostic scan and reboot immediately:

Code: Select all

 <Run>
%SystemDir%\MdSched.exe
->WaitWindow(10)
->WaitControl([CLASS:Button; INSTANCE:1],5)
->ClickControl([CLASS:Button; INSTANCE:1])
->WaitWindowClose()
->WaitWindow(2)
->WaitControl([CLASS:Button; INSTANCE:1],2)
->ClickControl([CLASS:Button; INSTANCE:1])
As you can see from the code, the scripts do exactly what we do manually to schedule the Memory diagnostics, but the clicks are so fast that nobody can really see what's going on.

Hope you guys find the scripts useful.
mdsched.uvk
(300 Bytes) Downloaded 652 times

Re: Script to auto schedule the Memory diagnostics tool

Posted: Wed Sep 03, 2014 6:21 pm
by Fred
And here's the proof that helping people always brings good things.

The same tech I mentioned in the previous post found out the command to schedule the Memory diagnostics on the next reboot, which I'm sharing here:

To schedule the Memory diagnostics on the next reboot:

Code: Select all

bcdedit.exe /bootsequence {memdiag}
To cancel the memory diagnostics:

Code: Select all

bcdedit /bootsequence {memdiag} /remove

Now it's easy to accomplish the task either from a UVK script or custom third party app.

Re: Script to auto schedule the Memory diagnostics tool

Posted: Mon Jun 08, 2015 3:08 pm
by Xander
Any thoughts to include this (the schedule part, not the 'now' part) in the defaults? Maybe alongside "Run Chkdsk on reboot"?

Re: Script to auto schedule the Memory diagnostics tool

Posted: Mon Jun 08, 2015 3:18 pm
by Fred
Hi Xander. No prob. Consider it done.

Re: Script to auto schedule the Memory diagnostics tool

Posted: Mon Jun 08, 2015 3:36 pm
by Xander
Cool. Merci.

Re: Script to auto schedule the Memory diagnostics tool

Posted: Wed Nov 18, 2015 8:02 pm
by Xander
Now that that's been implemented, what about the ability to import the results of that check into the System Info report?