I am trying to update some Active Directory attributes in C#. The C# app creates new computer objects and then populates some attributes. However, I am having problems with one attribute named netbootGUID, which is of type Octet String in AD. I haven't been able to find any working examples on the web. Part of the code follows:
DirectoryEntry entry = new DirectoryEntry( path, m_UserName, m_Password);
DirectoryEntry dChild = entry.Children. Add("CN=" + name, className);
// add attributes
dChild.Properti es["sAMAccountName "].Value = name + "$";
dChild.Properti es["serialNumb er"].Value = serial;
string guid = "4E435220000000 000000054012345 678"
// this doesn't work
dChild.Properti es["netbootGUI D"].Clear();
dChild.Properti es["netbootGUI D"].Add(guid);
// neither does this
dChild.Properti es["netbootGUI D"].Value = guid;
From what I can tell the netbootGUID attribute needs to be set as a byte[]. I tried converting the guid string to a byte[], I tried converting each char in guid to hex and then putting it into a byte[], however none of it has worked.
Does anyone have an example of updating an Octet value in AD with C#?
Thanks for any help.
---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/