Adding network service account to a windows built-in user group in c#
<p>I am trying to add network service account to a built in security group using the following code:</p>

<pre><code>DirectoryEntry de = new DirectoryEntry("WinNT://" + System.Environment.MachineName);                 
DirectoryEntry deGroup = de.Children.Find( groupName, "group");   &gt;&gt; here groupname = &lt;some builtin group&gt;
DirectoryEntry usr = de.Children.Find(accountName,”user”); &gt;&gt; here accountname = NT AUTHORITY\NETWORK SERVICE
deGroup.Invoke("Add", new object[] { usr.Path });
deGroup.CommitChanges();
</code></pre>

<p>The highlighted throws an exception “The user name could not be found”. What am I missing? How can I add network service to a builtin-group?</p>
