Click here to Skip to main content
15,897,718 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using Windows Live Maps Pin
EliottA27-Feb-09 5:06
EliottA27-Feb-09 5:06 
GeneralRe: Using Windows Live Maps Pin
cdpace27-Feb-09 5:15
cdpace27-Feb-09 5:15 
QuestionAdd Active Directory User to Local Group Pin
svh198527-Feb-09 4:56
svh198527-Feb-09 4:56 
Hello!

I have some code that add's users to my local administrator group.

But what i would like to accoplish is to add a user from an active directory to my localmachine admin group.

My code can add a local user to the local admin group.

I tried to alter the LDAP string for the ActiveDirectory connection but now it fails to add the domain user to the localmachine admin group.

The AD LDAP String: ldap://SERVERNAME01:389/CN=TESTUSER01,CN=Users,DC=DOMAIN01,DC=local
The Test String: WinNT://WORKGROUP/STEPHAN-F894E19/TestUser1

The Test String works the AD LDAP String doesn't work.

Can anyone help me with this?

Thanks!

the Code:
private void AddUserToGroup()
 {
     try
     {
         DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
         DirectoryEntry grp;

         grp = AD.Children.Find("Administrators", "group");
         if (grp != null) { grp.Invoke("Add", new object[] { "WinNT://WORKGROUP/STEPHAN-F894E19/TestUser1" }); }
         MessageBox.Show("Account Created Successfully");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }

AnswerRe: Add Active Directory User to Local Group Pin
svh198527-Feb-09 6:04
svh198527-Feb-09 6:04 
GeneralRe: Add Active Directory User to Local Group Pin
lane0p23-Mar-09 6:28
lane0p23-Mar-09 6:28 
QuestionConverting an Octet string into a string Pin
lane0p227-Feb-09 4:52
lane0p227-Feb-09 4:52 
AnswerRe: Converting an Octet string into a string Pin
Curtis Schlak.27-Feb-09 6:10
Curtis Schlak.27-Feb-09 6:10 
GeneralRe: Converting an Octet string into a string Pin
lane0p227-Feb-09 10:39
lane0p227-Feb-09 10:39 
GeneralRe: Converting an Octet string into a string Pin
Curtis Schlak.27-Feb-09 11:39
Curtis Schlak.27-Feb-09 11:39 
GeneralRe: Converting an Octet string into a string Pin
lane0p23-Mar-09 6:24
lane0p23-Mar-09 6:24 
AnswerRe: Converting an Octet string into a string Pin
Luc Pattyn27-Feb-09 6:24
sitebuilderLuc Pattyn27-Feb-09 6:24 
Questionhow can i call this method or function in c# ? Pin
yassir hannoun27-Feb-09 4:48
yassir hannoun27-Feb-09 4:48 
AnswerRe: how can i call this method or function in c# ? urgent!! Pin
Deresen27-Feb-09 4:59
Deresen27-Feb-09 4:59 
GeneralRe: how can i call this method or function in c# ?! Pin
yassir hannoun27-Feb-09 5:09
yassir hannoun27-Feb-09 5:09 
GeneralRe: how can i call this method or function in c# ?! Pin
Deresen27-Feb-09 5:18
Deresen27-Feb-09 5:18 
GeneralRe: how can i call this method or function in c# ?! Pin
yassir hannoun27-Feb-09 6:15
yassir hannoun27-Feb-09 6:15 
AnswerThe easy way Pin
Ennis Ray Lynch, Jr.27-Feb-09 6:02
Ennis Ray Lynch, Jr.27-Feb-09 6:02 
GeneralRe: The easy way Pin
yassir hannoun27-Feb-09 6:17
yassir hannoun27-Feb-09 6:17 
QuestionReduce the resolution of a PDF Pin
abbd27-Feb-09 4:05
abbd27-Feb-09 4:05 
RantRe: Reduce the resolution of a PDF Pin
Curtis Schlak.27-Feb-09 4:08
Curtis Schlak.27-Feb-09 4:08 
Question[sound recording using C#] anyone help me? [modified] Pin
pavelnaru27-Feb-09 3:48
pavelnaru27-Feb-09 3:48 
AnswerRe: [sound recording using C#] anyone help me? Pin
Deresen27-Feb-09 3:54
Deresen27-Feb-09 3:54 
GeneralRe: [sound recording using C#] anyone help me? Pin
EliottA27-Feb-09 5:07
EliottA27-Feb-09 5:07 
JokeRe: [sound recording using C#] anyone help me? Pin
Jim Crafton27-Feb-09 7:18
Jim Crafton27-Feb-09 7:18 
Questionapp.config issue Pin
George_George27-Feb-09 2:56
George_George27-Feb-09 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.