1
我在用戶變量中獲取空值..我在想什麼?將網絡服務用戶添加到管理組
PrincipalContext pc = new PrincipalContext(ContextType.Machine);
GroupPrincipal user = GroupPrincipal.FindByIdentity(pc, @"NT AUTHORITY\NETWORK SERVICE");
GroupPrincipal group = GroupPrincipal.FindByIdentity(pc, "Administrators");
group.Members.Add(user);
group.Save();