Preface:
We are using a Windows-7-Embedded
image, for making client-ready copies of our software.
The flow is pretty standard:
- Take a blank hard-drive.
- Restore an in-house
Windows-7-Embedded
image on the hard-drive. - Install additional software on-top.
- Hard-drive ready!
The Problem:
Sometimes, probably due to system crashes, some configurations that are already configured inside the image - reset.
My current problem is with a 'Disable Write Caching' option on the disk. In the image, the option is off. Sometimes, it just resets and turns on.
My Question:
How can I programmatically disable the disk write caching property?
Design Restrictions:
- Can run an .exe on startup. The system is mostly c++ so that is that would be the optimal language for a code based solution.
- Can run a .bat file.
- can run a .vbs file. Not sure which version our current infrastructure are compatible with.
Images (Inside Image -> After Crash):
Clarifications:
- Did my research. did not find anything related to windows write caching option in SO or SE as a whole. Did find a bunch of linux related questions.
- The system crashes are by-design, at the moment. This is the obvious root cause, but cannot be fixed due to design restrictions and budget issues.
There is a registry setting EnableCache you may try to experiment with. It applies to FAT file systems and setting it to 0 shall theoretically disable disk caching. Though I have not tested it.
Look into: HKEY_LOCAL_MACHINE\SYSTEM\StorageManager\FATFS or HKEY_LOCAL_MACHINE\SYSTEM\StorageManager\EXFAT