473,385 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

AD Octet String

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.Properties["sAMAccountName"].Value = name + "$";
dChild.Properties["serialNumber"].Value = serial;

string guid = "4E435220000000000000054012345678"

// this doesn't work
dChild.Properties["netbootGUID"].Clear();
dChild.Properties["netbootGUID"].Add(guid);
// neither does this
dChild.Properties["netbootGUID"].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/
Nov 17 '05 #1
1 7638
For anyone who is interested, I found the solution.

Mandatory attributes need to be written first and then you have to call CommitChanges(). For example:

entry = new DirectoryEntry(path, m_UserName, m_Password);
dChild = entry.Children.Add("CN=" + name, className);

// add attributes
dChild.Properties["sAMAccountName"].Value = name + "$";
dChild.Properties["serialNumber"].Value = serial;
// new security in AD requires a commit here after setting
// the mandatory attributes
dChild.CommitChanges();

string guid = "4E435220-0000-0000-0000-054012345678"
Guid myGuid1 = new Guid(guid);
dChild.Properties["netbootGUID"].Clear();
dChild.Properties["netbootGUID"].Add(myGuid1.ToByteArray());
dChild.CommitChanges();
---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matthew | last post by:
I am working on some software that uses SNMP to get information from routers and switches. I am using the pysnmp module (v2.0.8) to do the snmp part. The problem that I am having is that when I...
2
by: darrel | last post by:
Today I got my new XP machine (upgraded from 2k). After spending a day reinstalling all my apps and backups, I almost have things set up. I have put all my files back into wwwroot, but when...
2
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
1
by: Guoqi Zheng | last post by:
Dear sir, I am not fully understand the meaning of octet. For example, if I have a string contains unicode data of some Chinese characters, how can I convert it to an array of octet? Thanks...
7
by: wenmang | last post by:
Hi all, I have a confusion for representation of hex number: For an unsigned long long number, its max value is: unsigned long long maxNum = 18446744073709551615; if I do: printf("max uint64_t...
0
by: mylog | last post by:
Hi, I am facing a problem regarding the application/octet-stream.I have written a code that downloads a file stored in the App_Data folder to C:/files/ folder and now what problem I am facing is...
6
by: itgaurav198 | last post by:
Hi, Is it possible to convert a string in "Binary Octet String".?Also, if possible, please make clear what "Binary Octet String" is. Thanks
2
by: miltizem | last post by:
Guys i'm using a software to monitor the signal over noise factor of a traffic ... The result is given under two formats .. First an octet string Second a decibel number my question how can i...
2
by: DragonLord | last post by:
Hi guys, I am curently working with ADAM and AZMAN and I would like to store the users passord in the ADAM database. However it is of type Octet String. Being knew to the world of C# I have no...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.