摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Security.AccessControl;using System.Security.Principal;namespace SetFileAcl{ class Program { static void Main(string[] args) { string fileName = "c:\\testFile... 阅读全文
posted @ 2013-07-12 13:48 Mr..Hu 阅读(768) 评论(0) 推荐(0) 编辑
摘要: 使用FileSecurity类和FileInfo类。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Security.AccessControl;using System.Security.Principal;namespace GetFileAcls{ class Program { static void Main(string[] args) { stri... 阅读全文
posted @ 2013-07-12 13:38 Mr..Hu 阅读(562) 评论(0) 推荐(0) 编辑
摘要: 使用net.exe可创建本地账户,注意,一下代码运行在管理员账户的elevated priviledge模式之下。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;using System.IO;using System.Security.Principal;namespace CreateLocalUser{ class Program { static void CreateLocalUser(stri... 阅读全文
posted @ 2013-07-12 12:30 Mr..Hu 阅读(530) 评论(0) 推荐(0) 编辑
摘要: 基于.Net Framework 4.0,使用Windows Identity类可获取当前账户的相关信息,包含账户名称,SID,组成员关系等。代码如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Security.Principal;namespace WindowsSecurityViaCSharp{ class Program { static void Main(string[] args) { ... 阅读全文
posted @ 2013-07-12 11:56 Mr..Hu 阅读(760) 评论(0) 推荐(0) 编辑