473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Searching the domain with WinNT Provider in ASP.NET

Hello,

I'm trying to get Users that belong to a group with the WinNT Provider in an ASP.NET environment.
I found several examples to do this under ASP using the GetObject-Method (GetObject("WinNT//:Domain/...).
But how does it work in VB.NET?
Can I use the GetObject-Method, or is the usage of DirectoryServices or ADSI the right way?An example please.
Matthias
--------------------------------
From: Matthias Mohr

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>GLrEpOfsAEW49Y1YmT2f0Q==</Id>
Nov 18 '05 #1
1 1896
Hi,

you can use WMI :

Add reference to System.Management.dll.
using System.Management;

....

string myDomain = "ChangeTo_DomainName";
string theUser = "ChangeTo_UserName";
string query = "SELECT * FROM Win32_GroupUser " +
"WHERE PartComponent = \"Win32_UserAccount.Domain='" + myDomain +
"',Name='" + theUser + "'\"";
SelectQuery selectQuery = new SelectQuery(query);
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(selectQuery);

foreach( ManagementObject obj in searcher.Get())
{
Console.WriteLine(obj.GetPropertyValue("GroupCompo nent"));
}
Console.ReadLine();
Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dirk Hagemann | last post by:
Hi! I'm using this code to list all computers of our WinNT-Domains: import win32com.client from pprint import pprint as p domain='domainX' auswahl='computer' def enumerate(domain,auswahl):...
2
by: R Chown | last post by:
Using vbscript I can get the domain of a server by binging to the WinNT provider and then getting the ADsPath Set comp = GetObject("WinNT://MyComputer" sComputerAndDomain = comp.ADsPat How do...
1
by: Frank00 | last post by:
I run a .NET based portal product. I am using windows authentication. This mode of authentication and the string specifying the connection to AD is specified in the application's web.config file....
0
by: Oliver | last post by:
Hello, I may have posted in the wrong place, if so, feel free to move my post (just notify me where you put it via email or something) I’m having a problem with my program that I cant...
1
by: uiranejeb | last post by:
How can I determine the windows groups from a domain? How can I determine all the windows groups to which a user belongs to? (WindowsPrincipal says if a user belongs to a specific group. I need a...
7
by: Peter Steele | last post by:
I have code to add a domain user to a local group but I'm not sure if it will work with NT domains or whether it will only work with Active Directory based systems. Here's the code: public void...
1
by: missoula | last post by:
Hello- I can connect to my own domain fine with the following: entry = new DirectoryEntry("LDAP://RootDSE"); However, I am trying to get information out of AD for another domain. This...
4
by: NetRacer | last post by:
i'm checking the logged on user at start of my program. if the user is not in my database (e.g. he uses his private notebook instead of the company desktop), i want to show a login screen where he...
5
by: Michael Howes | last post by:
I'm writing a utility to manage a machines *local* accounts in c# I am getting all the users in a specific Group just fine but when I want to get some of the information on each user from their...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.