Running as an administrator is necessary, but not enough, you also need to enable Backup , as implicitly described here: Connection points
% The SystemDrive directory% \ Documents and Settings is now saved in the% SystemDrive% \ Users [...] directory. Backup applications should be able to backup and restore the connection point.
So here is an example that works:
using (Privilege p = new Privilege(Privilege.Backup)) { foreach (string path in Directory.GetFileSystemEntries(@"c:\documents and settings")) { Console.WriteLine(path); } }
Note that there is no public .NET class to enable the privilege programmatically, as far as I know, but inside System.Security.AccessControl (mscorlib), which I opened with a thin shell, there is one internal. It is based on the fully open Windows AdjustTokenPrivileges function .
source share