--BEGIN RANT--
ALL I want to do is copy the "Documents and Settings" folder to back it up in Windows Server 2003, so we can grab old files from it, as needed, easily, after I wipe the server to upgrade the OS to Windows Server 2008. BUT, I get errors about NTUSER being in use, etc., when I try to copy it. It's VERY irritating that an administrator can't just use Windows explorer to copy folders, but what-ever.
I don't have time to jump through security hoops, wiping out permissions. I don't have time to initiate a HUGE folder copy only to have it fail some random % through the operation when it runs into an open file handle. I don't have time to repeat this process over and over, hunting down the open file handle and closing it with process explorer each time, destabilizing the system as a side effect.
--END RANT--
I understand that a user-mode process can have some kind of flag that allows it to bypass NTFS security.
How do I give this "backup" role (
SE_BACKUP_NAME
/SE_RESTORE_NAME
) to a process, such as a C# program?Can it be done in managed code (or am I gonna have to dig up Win32 API docs, or hand-write manifests and embed them who-knows-where, or track down some obscure backup-program-registration command-line-utility)?
How do I open a file in C# with backup semantics, so I can copy the file?
Will open file handles (with exclusive read-locks) interfere with reading the file for backup purposes, or will opening it with backup semantics take care of that, and temporarily suspend writing to the file while it's opened for backup?
I'm asking here, because it's useful information to remain on-record at stackoverflow, that someone probably can spout off the top of their head, that I don't have time to look up myself. Thank you.
Soon enough, I'll be upgrading some servers to the nightmare that is Windows Server 2008 and learning the icacls command utility, thanks to Microsoft removing GUI support for editing security on multiple folders/files (smart move. not.)