Access to every file on the file system (doesn't matter) in Windows 7
In C #, on a Windows 7 machine, how can I programmatically access every file in the filesystem as if I were the "main administrator".
The main priority here is that after installing my C # program, it won't work in any file / folder access issues. My program runs as a Windows service and it should allow the user to back up any files on the file system.
a source to share
I would think it would work if you just make sure the service is running under a group account Backup Operator
. I thought the group has access to all files no matter what permissions exist.
Quoting from MS support page:
SID: S-1-5-32-551 Name: Backup statements Description: Built-in group. By default, the group has no members. Backup Operators can back up and restore all files on a computer, regardless of the permissions protecting those files. Backup operators can also log on to the computer and shut it down.
Although this page is for earlier versions of Windows, so I'm not 100% sure that it hasn't been changed.
a source to share
There is a Win32 backup API which is most likely what you want, possibly in conjunction with Shadow Print Service . And your application must have the SeBackupPrivilege privilege . Note, however, that files encrypted with EFS can be read, but only in encrypted form.
Links that may be of interest to you:
http://mutable.net/blog/archive/2006/11/21/an-intelligent-backup-system-for-windows-part-3.aspx
http://msdn.microsoft.com/en-us/library/aa362520(v=VS.85).aspx
a source to share
You need to configure the service to run under an account with sufficient privileges.
AFAIK the Local System standard already has pretty high privileges. But regardless of whether you will be able to access files reserved for the system account or files that are used exclusively. Your program will always be able to handle Internet-related exceptions.
a source to share