Hi All,
I am using the DirectorySearch er class for reading the active directory users. But the result shows the IUSR accounts also.
I dont want to take the IUSR accounts.
So please help me to take the usernames with out IUSR accounts from the active directory.
Is any attributes for remove those IUSR accounts?
Thanks in Advance.
Regards,
Dhanasekaran. G
5 7693 Plater 7,872
Recognized Expert Expert
Do a post process on your data, removing the IUSER accounts?
Offhand I don't know of any attributes, but you could look at them in windows and see if there is anything in common
Hi All,
I am using the DirectorySearch er class for reading the active directory users. But the result shows the IUSR accounts also.
I dont want to take the IUSR accounts.
So please help me to take the usernames with out IUSR accounts from the active directory.
Is any attributes for remove those IUSR accounts?
Thanks in Advance.
Regards,
Dhanasekaran. G
you must specify what you want at the DIrectorySearch er filter
ex C#: - search.Filter = "(&(objectClass=user)(objectCategory=person))";
Here is an example: - public static ArrayList GetAllADDomainUsers(string domainpath)
-
{
-
ArrayList allUsers = new ArrayList();
-
DirectoryEntry searchRoot;
-
-
searchRoot = new DirectoryEntry(domainpath);
-
-
DirectorySearcher search = new DirectorySearcher(searchRoot);
-
search.Filter = "(&(objectClass=user)(objectCategory=person))";
-
search.PropertiesToLoad.Add("samaccountname");
-
-
SearchResult result;
-
SearchResultCollection resultCol = search.FindAll();
-
-
if (resultCol != null)
-
{
-
for(int counter=0; counter < resultCol.Count; counter++)
-
{
-
result = resultCol[counter];
-
if (result.Properties.Contains("samaccountname"))
-
{
-
allUsers.Add((String)result.Properties["samaccountname"][0]);
-
}
-
}
-
}
-
return allUsers;
-
}
Hi,
thanks for your reply. But still i am getting the following user accounts.
IWAM_DOMAINCS, IUSR_DOMAINCS,
my code is:
DirectorySearch er Searcher = new DirectorySearch er();
Searcher.Search Scope = SearchScope.Sub tree;
Searcher.Proper tiesToLoad.Add( "sAMAccountName ");
Searcher.Filter = "(&(objectClass =user)(objectCa tegory=person)) ";
DataTable dtUsers = new DataTable("User InAD");
dtUsers.Columns .Add("uname");
string str = "";
foreach (SearchResult AdObj in Searcher.FindAl l())
{
str += Convert.ToStrin g(AdObj.Propert ies["sAMAccountName "][0]) + "\n";
DataRow dr = dtUsers.NewRow( );
dr[0] = Convert.ToStrin g(AdObj.Propert ies["sAMAccountName "][0]);
dtUsers.Rows.Ad d(dr);
}
please help me.
thanks in advance.
Regards,
Dhanasekaran. G
Hi,
thanks for your reply. But still i am getting the following user accounts.
IWAM_DOMAINCS, IUSR_DOMAINCS,
my code is:
DirectorySearch er Searcher = new DirectorySearch er();
Searcher.Search Scope = SearchScope.Sub tree;
Searcher.Proper tiesToLoad.Add( "sAMAccountName ");
Searcher.Filter = "(&(objectClass =user)(objectCa tegory=person)) ";
DataTable dtUsers = new DataTable("User InAD");
dtUsers.Columns .Add("uname");
string str = "";
foreach (SearchResult AdObj in Searcher.FindAl l())
{
str += Convert.ToStrin g(AdObj.Propert ies["sAMAccountName "][0]) + "\n";
DataRow dr = dtUsers.NewRow( );
dr[0] = Convert.ToStrin g(AdObj.Propert ies["sAMAccountName "][0]);
dtUsers.Rows.Ad d(dr);
}
please help me.
thanks in advance.
Regards,
Dhanasekaran. G
You're right, ive been searching, cant find a way to directly removing them on the filter, i think you should follow platers advice, do some post proccess to remove these accounts, although you have to think a way to make this efficient, since there can be a considerable amount of users. sorry i couldnt help
Plater 7,872
Recognized Expert Expert
I think there is a way to use SQL to query against active directory. (I saw it somewhere burried in msdn once i think)
That might be useful to throw in a "WHERE UserName NO like 'IUSER%' " or something.
Maybe you can do that with DirectorySearch er too though?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: scmiles |
last post by:
I am trying to write an asp or aspx page that will create
a virtual ftp directory to the users Active Directory
home directory. That way a user can interact (drag/drop,
copy/paste) via IE with folder view for ftp sites.
I have some code, that seems to be "flaky" it works for
me and some others, but not everyone. I really need to
get a...
|
by: Luis Esteban Valencia |
last post by:
Hello gusys, Is it possible to make my asp.net application add users to the
AD , I also want to be able to delete users, modify their information,
everything through a website.
Thanks for the info
|
by: tangus via DotNetMonster.com |
last post by:
Hello all, I'm really struggling with getting some Active Directory code to
work in ASP.NET. Can you please provide assistance? I am executing the
following code:
Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://domain")
Dim mySearcher As New DirectorySearcher(enTry)
Dim resEnt As SearchResult
mySearcher.Filter =...
|
by: Patrick.O.Ige |
last post by:
If i want to generate a menu structure depending on who is logged in
in an intranet system(using windows authentication) is it better to use the
GROUPS in Active Directory
or to move the Active Directory groups into a Sql Server database and base
the authrorization and authentication on the SQL Server roles/groups?
Whats the best way to make...
|
by: Jm |
last post by:
Hi All
Im not sure of which way to go about this so ill start by explaining what im
trying to do and the options ive come up with. ok..
I have a client program which talks to an sql server database whenever a
machine is turned on. It reports the client machine status to the server and
accepts incoming tcp connections for various...
| |
by: Lucky |
last post by:
hi guys,
after long long efforts i got access to the active directory for
"Intigrated windows authentication". now i', suppose to get access the
network resources.
the problem is i'm getting access to the active directory but when i
search for some users into the active directory, it returns none though
there are more then 42 users exists....
|
by: Jim in Arizona |
last post by:
My goal, somehow, is to populate a dropdownlist with all the user names
in active directory. I don't even know where to begin, really.
I added a reference to System.DirectoryServices so I could use the
System.DirectoryServices.ActiveDirectory namespace. I don't even know if
this is the right way to go as I can't seem to find anything in that...
|
by: catherine |
last post by:
Hi, I am trying to work out how I can disable / enable **another**
users Active Directory account not my own via C#.
If I create a directory entry like so I need to know the other users
password befoew I can do anything with the user. Obviously I will not
know this information
DirectoryEntry de = new DirectoryEntry();
de.Path =...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |