TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Scott Furr
NA
15
0
Need to query against the IPPhone property
Jul 3 2012 10:52 AM
I'm trying to pull a list of users from Active Directory and I am succeeding, but I'm also pulling service accounts, which I do not want. The distinguishing factor between a real user and a service account is the IPPhone property. I found the PrincipalSearcher class but it doesn't contain the IPPhone Property. Anyone know how to add it or query it in some other way?
My code is below.
static void Main(string[] args)
{
string groupName = "Domain Users";
string domainName = "DOMAIN";
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domainName);
GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, groupName);
if (grp != null)
{
foreach (Principal p in grp.GetMembers(false))
{
Console.WriteLine(p.Name + " - " + p.DisplayName);
}
grp.Dispose();
ctx.Dispose();
Console.ReadLine();
}
else
{
Console.WriteLine("\nWe did not find that group in that domain, perhaps the group resides in a different domain?");
Console.ReadLine();
}
}
Thanks in advance
Reply
Answers (
0
)
Thanks for the script
Searching for User and Group.