Currently I am trying to run a test that will power-down the machine abruptly when a file is being written. When power-down occurs the last part of data is not present as it is never flushed to disk before power down.
Perl (in Linux) allows direct un-buffered writes when a file is opened in the following manner.
sysopen(F, $file, O_WRONLY|O_DIRECT) or die "Couldn't direct open file $file\n";
This allows data to be written till the last character in-case machine crashes due to some reason. Likewise, for windows, C++ allows direct writes when a file is opened for writes using "FILE_FLAG_NO_BUFFERING" flag.
How can I allow direct/un-buffered writes to disk using powershell ?