7
我使用Window 2003服務器,並且需要以編程方式使用C#獲取有關安全性文件夾的信息。以編程方式獲取Windows 2003中文件夾的組用戶權限特殊權限列表
我想創建一個檢查權限的工具。我需要得到組,用戶權限和特殊權限的文件夾,
C:\ Documents和Settings \所有 用戶\應用 數據\微軟\加密\ RSA \ MachineKeys的
編輯:
以下是GetSecurityDescriptorSddlForm方法的示例代碼。
public static string GetObjectPermission(string fullFolderName)
{
FileSecurity fileSecure = File.GetAccessControl(fullFolderName);
StringBuilder acer = new StringBuilder();
fileSecure.GetSecurityDescriptorSddlForm(AccessControlSections.All);
foreach (FileSystemAccessRule ace in fileSecure.GetAccessRules(true, true, typeof(NTAccount)))
{
acer.Append(ace.FileSystemRights + ":" + ' ' + ace.IdentityReference.Value + "\n");
}
return acer.ToString();
}
此示例代碼將告訴您哪個NTAccount可以修改或讀取文件夾,如此函數。
我該如何獲得羣組和特殊權限?
任何示例代碼,建議?
當你說「獲取特殊權限,」你想只知道,如果他們有他們,或者他們的實際是? – Gray 2013-07-26 17:11:54
我想知道他們是否真的擁有什麼權限。 – Kiquenet 2013-07-29 06:54:30
啊,好的。因爲很容易判斷他們是否會在Windows資源管理器中檢查特殊權限的框,因爲它返回負數。但將該號碼的每個部分與權限關聯起來會更復雜一些。 – Gray 2013-07-29 12:21:08