I'm trying to access the directory C:\Windows\System32\winevt in my code, but I get a System.IO.DirectoryNotFoundException
.
I read this thread: Anyone know why I can't access the winevt folder programmatically in C#?
This implies that running a 32-bit application under a 64 bit operating system will re-direct me to SystemWOW64 directory, and the resolution is to instead set my directory to %windir%\Sysnative\winevt
. So I modified my code to conform to the answer provided in the aforementioned thread, except it still fails. I'm running windows 10 enterprise 64-bit and Sysnative doesn't exist.
Example Code:
This will return true:
string directory = @"C:\Windows\System32";
bool isDirectoryExists = Directory.Exists(directory);
This will return false:
string directory = @"C:\Windows\System32\winevt";
bool isDirectoryExists = Directory.Exists(directory);
There is no winevt directory in the directories System and SysWOW64, and Sysnative does not exist. So my question is, how do I get access to the winevt directory?