Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

How to add a domain user to local remote desktop users group using C#.

$
0
0
Hi,

I am trying to add a domain user to machines local remote desktop users group in the following way, but failed to get the expected result.

 

DirectoryEntry AD = newDirectoryEntry("WinNT://" + Environment.MachineName + ",computer", "resources", "asdf1234");

 

DirectoryEntry banvsgAD = newDirectoryEntry("LDAP://CN=Users,DC=easydom,DC=com", "domadmin", "dom123#");

 

DirectoryEntry domainUser = banvsgAD.Children.Find("domuser");

 

DirectoryEntry newUser = AD.Children.Add(@"easydom\domuser", "user");

 

newUser.CommitChanges();

 

DirectoryEntry grp;

grp = AD.Children.Find("Remote Desktop Users", "group");

if (grp != null) { grp.Invoke("Add", new object[] { newUser.Path.ToString() }); }

I am pretty to new to use the DirectoryServices concepts. Could somebody help me pointing to informative resources in this regard.

Thanks for the support in this regard.

Friendly,
Kamesh.


Thanks, Sri

Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>