473,480 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add Active Directory Users to a Group on a Workstation

Found the following on Microsoft's website,
http://support.microsoft.com/kb/306271, but it only seems to work when
creating an account on a workstation. I am new to VB.NET (2005).

TIA!

://Bill

Dec 22 '06 #1
8 1728
are you asking to do it remotely?
<wh*****@gmail.comwrote in message
news:11**********************@h40g2000cwb.googlegr oups.com...
Found the following on Microsoft's website,
http://support.microsoft.com/kb/306271, but it only seems to work when
creating an account on a workstation. I am new to VB.NET (2005).

TIA!

://Bill

Dec 22 '06 #2
Examples of both would be great, but locally is what I am looking for.
://Bill

vbnetdev wrote:
are you asking to do it remotely?
<wh*****@gmail.comwrote in message
news:11**********************@h40g2000cwb.googlegr oups.com...
Found the following on Microsoft's website,
http://support.microsoft.com/kb/306271, but it only seems to work when
creating an account on a workstation. I am new to VB.NET (2005).

TIA!

://Bill
Dec 22 '06 #3
Then I don't understand. The MS example should work for you locally.
what happens when you try?

<wh*****@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Examples of both would be great, but locally is what I am looking for.
://Bill

vbnetdev wrote:
>are you asking to do it remotely?
<wh*****@gmail.comwrote in message
news:11**********************@h40g2000cwb.googleg roups.com...
Found the following on Microsoft's website,
http://support.microsoft.com/kb/306271, but it only seems to work when
creating an account on a workstation. I am new to VB.NET (2005).

TIA!

://Bill

Dec 22 '06 #4
THe following is my code which doesn't work:

Sub Main()
Dim AD As DirectoryEntry = New DirectoryEntry("WinNT://" +
Environment.MachineName + ",computer")
Dim grp As DirectoryEntry

grp = AD.Children.Find("Administrators", "group")

If grp.Name <"" Then
Console.WriteLine("Going to add to group")
grp.Invoke("Add", New Object() {"<domain>\<user>"})
Else
Console.WriteLine("Group does not exist")
End If
End Sub

Debugging says: System.Reflection.TargetInvocationException was
unhandled

Thanks for working with me!

Dec 22 '06 #5
Bump...

What am I doing wrong??

Dec 23 '06 #6
What line did the error occured?

what does bump mean?

<wh*****@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
Bump...

What am I doing wrong??

Dec 23 '06 #7
Dump just meant that I am trying to keep the post alive, hoping someone
else may see it.
It's erroring out at grp.Invoke("Add", New Object()
{"<domain>\<user>"})

://Bill

Dec 23 '06 #8
Figured it out. Should be:

Dim StrUserEntry As String
StrUserEntry = "WinNT://<domain>/<server>/<userid>"

Dim group As DirectoryEntry = New DirectoryEntry("WinNT://" +
Environment.MachineName + "/Administrators,group")

group.Invoke("Add", New Object() {StrUserEntry})
group.CommitChanges()

Dec 23 '06 #9

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

Similar topics

2
734
by: Sara | last post by:
Dear Sir, I want to access to a special group in active directory but with this function I could just see that a special user is exist in active directory or not, I mean I want to see that a user...
10
5398
by: huzz | last post by:
I have web application that quaries the Active Directory to get user details.. everything works fine but someday I'll get System.Runtime.InteropServices.COMExection and if I restart the client...
0
1824
by: Kenneth Keeley | last post by:
Hi, I have been working on a Login page that uses ADSI to authenicate the users. I had this all working on my test system and on a second system connected to the live domain. Now it will only work...
3
3459
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...
1
3871
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 =...
4
2333
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...
0
1227
by: Sara | last post by:
Dear Sir, I want to access to a special group in active directory but with this function I could just see that a special user is exist in active directory or not, I mean I want to see that a user...
2
6796
by: Alex | last post by:
Dear all I hope you might help me. Here my issue: I am using the following vb.net code to receive members from a windows 2000 active directory group: objecttolook = "group" objlook =...
0
2720
by: jakobsgaard | last post by:
It is possible to Map a certificate to a Active Directory User Account from DotNet? Please provide an example. Best regards, Ejnar Jakobsgaard...
2
5943
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...
0
7044
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
7087
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
6944
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
5341
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
4782
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
4483
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
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
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 ...
0
182
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.