Script to auto schedule the Memory diagnostics tool

Post tutorials and script examples in this forum.
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Post Reply
Fred
Site Admin
Posts: 2322
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Script to auto schedule the Memory diagnostics tool

Post 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 239 times
Attachments
mdsched2.uvk
(288 Bytes) Downloaded 208 times
The only thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Fred
Site Admin
Posts: 2322
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Script to auto schedule the Memory diagnostics tool

Post 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.
The only thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 428
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Script to auto schedule the Memory diagnostics tool

Post by Xander »

Any thoughts to include this (the schedule part, not the 'now' part) in the defaults? Maybe alongside "Run Chkdsk on reboot"?
Fred
Site Admin
Posts: 2322
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Script to auto schedule the Memory diagnostics tool

Post by Fred »

Hi Xander. No prob. Consider it done.
The only thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 428
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Script to auto schedule the Memory diagnostics tool

Post by Xander »

Cool. Merci.
Xander
Posts: 428
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Script to auto schedule the Memory diagnostics tool

Post by Xander »

Now that that's been implemented, what about the ability to import the results of that check into the System Info report?
Post Reply