Don’t try to write where applications should not write. Use other folders like for example:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
If there is no possible alternative, which I seriously doubt, run the executable with administrative privileges.