I have written a simple piece of code to try and copy the WebCacheV01.dat file from the Edge Browser, as the fille is locked I am using the VSS commands to do this.
When I run the command manually, from an elevated prompt, it copies the database without any issue. When I try to replicate the command using C#, it errors.
VSS Subsystem Init failed, 0x80042302 Operation terminated with error -2403 (JET_errOSSnapshotNotAllowed, OS Shadow copy not allowed (backup or recovery in progress)) after 0.47 seconds.
I have run the debugging, line by line and the arguments are correct. I just can't get around the error message.
using (var cmdEsentutl = new Process())
{
cmdEsentutl.StartInfo.FileName = "esentutl";
cmdEsentutl.StartInfo.UseShellExecute = false;
cmdEsentutl.StartInfo.CreateNoWindow = false;
//cmdEsentutl.StartInfo.Arguments = $@"/y /vss {GlobalVariables.edge44HistoryDB}\WebCacheV01.dat /d E:\WebCacheV01.dat";
cmdEsentutl.StartInfo.Arguments = $@"/y {GlobalVariables.edge44HistoryDB}\WebCacheV01.dat /vssrec V01 . /d F:\WebCacheV01.dat";
cmdEsentutl.StartInfo.Verb = "runas";
cmdEsentutl.StartInfo.RedirectStandardError = true;
cmdEsentutl.Start();
cmdEsentutl.WaitForExit();
}
User contributions licensed under CC BY-SA 3.0