Z
ZzZoel
Hi all,
I'm new to this group but I've found many usefull discussions here.
Here's my problem/question. I want to add a domain account to a local
administrator group of one of the domain servers via a webservice
written in C#. I've read most discussion on creating a user and adding
the user to a group using the directoryservices namespace but so far I
haven't been successfull.
Below some lines of code I've used and works but creates a new local
user:
//******************************************
DirectoryEntry _localContainer = new DirectoryEntry("WinNT://" +
Environment.MachineName + ",computer", "administrator", "password");
DirectoryEntry _userNew = _localContainer.Children.Add("test
user","user") as DirectoryEntry;
_userNew.Invoke("SetPassword", new object[] {"test"});
_userNew.Invoke("Put", new object[]{"Description","test account"});
_userNew.CommitChanges();
//*******************************************
Instead I want to add an existing domain account to the administrator
group of the server2003 machine the webservice is located on.
Any ideas or hint would be very much appreciated!
Thanx,
Suly
I'm new to this group but I've found many usefull discussions here.
Here's my problem/question. I want to add a domain account to a local
administrator group of one of the domain servers via a webservice
written in C#. I've read most discussion on creating a user and adding
the user to a group using the directoryservices namespace but so far I
haven't been successfull.
Below some lines of code I've used and works but creates a new local
user:
//******************************************
DirectoryEntry _localContainer = new DirectoryEntry("WinNT://" +
Environment.MachineName + ",computer", "administrator", "password");
DirectoryEntry _userNew = _localContainer.Children.Add("test
user","user") as DirectoryEntry;
_userNew.Invoke("SetPassword", new object[] {"test"});
_userNew.Invoke("Put", new object[]{"Description","test account"});
_userNew.CommitChanges();
//*******************************************
Instead I want to add an existing domain account to the administrator
group of the server2003 machine the webservice is located on.
Any ideas or hint would be very much appreciated!
Thanx,
Suly