473,395 Members | 1,856 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,395 software developers and data experts.

Getting user group for a user

Hi! Can anyone tell me how can I get the user group for the current windows
user? Please help me!

Sabin Finateanu
Nov 16 '05 #1
2 2416
Hi Sabin,

You can check the user against known Windows group names by using
WindowsPrincipal's IsInRole method. Retrieving unknown group names
(which sounds like the case here) may pose more of a problem for you. If
you're on a Win2K network you may have access to Active Directory
services, and you could then take advantage of the functionality offered
by the System.Directory namespace. Without Active Directory I believe
your answer becomes more elusive (maybe others can offer potential
solutions in this case).

Good luck!

- Mike

Sabin Finateanu wrote:
Hi! Can anyone tell me how can I get the user group for the current windows
user? Please help me!

Nov 16 '05 #2
Sabin,
as mike stated, checking this out without AD is different. for AD searches
and queries you use the DirectorySearcher class (under the DirectoryServices
namespace) using the LDAP protocol. for non-AD queries, use the same calss
with the WinNT protocol.

for a quick start, look for the DirectoryEntry.Path Property on the MSDN
help.

Picho
"Mike Ryan" <CA***********@gmail.com> wrote in message
news:td********************@comcast.com...
Hi Sabin,

You can check the user against known Windows group names by using
WindowsPrincipal's IsInRole method. Retrieving unknown group names (which
sounds like the case here) may pose more of a problem for you. If you're
on a Win2K network you may have access to Active Directory services, and
you could then take advantage of the functionality offered by the
System.Directory namespace. Without Active Directory I believe your answer
becomes more elusive (maybe others can offer potential solutions in this
case).

Good luck!

- Mike

Sabin Finateanu wrote:
Hi! Can anyone tell me how can I get the user group for the current
windows user? Please help me!

Nov 16 '05 #3

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

Similar topics

4
by: Tim Daneliuk | last post by:
OK, I've Googled for this and cannot seem to quite find what I need. So, I turn to the Gentle Geniuses here for help. Here is what I need to do from within a script: Given a username and a...
3
by: BobTheDatabaseBoy | last post by:
.... got: win2K, v8.1.6 login to win2K is to the network: user; bob13, domain; foo it's a win2K domain. i then login to my local db as db2admin. LIST APPLICATIONS fails with security error. ...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
11
by: Derek Martin | last post by:
Using VB.Net, I would like to retrieve the currently logged in user's DN from Active Directory. Alternatively, if, using WindowsIdentity, or something similar, I would like to get the user's full...
0
by: Erik | last post by:
Why isn't my update method getting called? Pasted below is an aspx from a 1.1 application I'm working on. It has two textboxes and a button for inserting data into the database, and a datagrid...
4
by: shashank kadge | last post by:
hi all, i am trying to get local admin users and groups on a windows server. here is the C# code that i am using...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
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...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

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.