473,479 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Username, local group, IsInRole

Hi,

I would like to do the following on the WinXP SP2 using .Net framework 1.1 &
C#:

If I know the username (can be domain user or just local user), I do not
know the password, and I know the group name (local group) and the user is
NOT the current user, how can I determine if:
1. The user is defined on this machine
2. The user belongs to the local group

The check will be performed on the machine itself so no client-server access
issues.

Thanks in advance,
Anna

Dec 2 '05 #1
1 2254
AFAIK if you operate locally, then there is no Active Directory info. You
can P/Invoke and use security API or network management api

Have a look at these functions
NetUserAdd
NetUserEnum
NetUserGetRroups
NetUserGetLocalGroups - returns local groups to which the user belongs
etc....

These functions reside in win32 dll - Netapi32.dll

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Anna" <An**@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
Hi,

I would like to do the following on the WinXP SP2 using .Net framework 1.1
&
C#:

If I know the username (can be domain user or just local user), I do not
know the password, and I know the group name (local group) and the user is
NOT the current user, how can I determine if:
1. The user is defined on this machine
2. The user belongs to the local group

The check will be performed on the machine itself so no client-server
access
issues.

Thanks in advance,
Anna

Dec 5 '05 #2

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

Similar topics

2
8143
by: innesm | last post by:
Hi, Although I havent been able to find any documentation to confirm it, it looks like any change to a windows local group's membership is only reflected in the group editing UI (and the...
3
10764
by: Scott | last post by:
I need to be able to verify group membership in my C# application. All the examples I seem to find show how to query the BUILTIN groups. I need to be able to query the DOMAIN groups. Can I have...
2
2123
by: Kevin Wen | last post by:
Hi Sirs, How could i determine if an user belongs to a specific group, especially nested group. thanks, -Kevin
5
7760
by: Fred | last post by:
I would like to display the username of the visitor top a web page. This is assuming that the visitor is coming from within a winodws2000 Domain. I have tried the following but it gives me the...
9
3747
by: Sameh Ahmed | last post by:
Hello there Is there a way through dotNet to check if a certain user is a member of a specific group? I use ADSI to get the memberships of the user then compare them to the group I want to check,...
7
5593
by: Sameh Ahmed | last post by:
Hello there IsInrole gives ya the means to check if the current or impersonated user belongs to a specific windows role or group. is there a way to do the same without using ADSI to check if...
0
881
by: Wayne | last post by:
I need to create a security group on the local machine. I will subsequently check the user's credentials using: WindowsPrincipal.IsInRole("MACHINENAME\SomeGroup") from...
11
13309
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified user, but hangs in a suspended state. In fact, any...
0
6635
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
0
7071
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
6861
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
5318
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,...
1
4763
isladogs
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...
0
4468
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...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
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 ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
170
bsmnconsultancy
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...

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.