?
Solved

Secret field on a Computerobject in AD

Posted on 2009-02-24
20
Medium Priority
?
469 Views
Last Modified: 2013-11-23
Can someone tell me if there is a "secret" field on a computer object in AD?

And can you edit the "whenChange" field on the computer object?
0
Comment
Question by:QC20N
  • 11
  • 9
20 Comments
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23735327
why do you need a secret field ?
i'm guessing you need to store extra info ?
0
 

Author Comment

by:QC20N
ID: 23742617
:) Yes, you are correct. I need to store the date of the computer when it was "born" and from that we control when the warranty ends.
0
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 2000 total points
ID: 23742834
just pick any property ... with this WriteProperty procedure

we found businessRoles was not used

i use it the propvalue as a delimited item string

var
  List: TStrings;
  dtBorn: TDateTime;
begin
  List := TStringList.Create;
  try
    List.Values['BORN'] := FormatDateTime('DD-MM-YYYY HH:NN:SS', dtBorn);
    List.Values['LICENSE_X'] := '1';
    List.Values['LICENSE_Y'] := '2';
    WriteProperty(ComputerObj, List.DelimitedText, True);
  finally
    FreeAndNil(List);
  end;
procedure TYourClass.WriteProperty(Obj: IAds; propvalue: string; append: boolean; propname: string = 'businessRoles');
var prop: OleVariant;
  temp: string;
begin
  if not append then
  try
    Obj.PutEx(ADS_PROPERTY_CLEAR, propname, EmptyStr);
    Obj.SetInfo;
  except
    on E: Exception do;
      //AddLog(logimport, 'error clearing property ' + propname + ' : ' + E.Message);
  end;
  if propvalue <> '' then
  try
    try
      prop := VarArrayOf([propname]);
      Obj.GetInfoEx(prop, 0);
      prop := Null;
    except
      on E: Exception do ;
        //AddLog(logimport, 'error reading property ' + propname + ' : ' + E.Message);
    end;
    if (propvalue = '') or ((propvalue <> '') and (propvalue[1] <> '"') and (propvalue[length(propvalue)] <> '"')) then
      propvalue := AnsiQuotedStr(propvalue, '"');
    if append then
    begin
      temp := ReadProperty(Obj);
      if temp <> '' then
        propvalue := temp + ',' + propvalue;
    end;
    prop := VarArrayOf([propvalue]);
    Obj.PutEx(ADS_PROPERTY_UPDATE, propname, prop);
    Obj.SetInfo;
    prop := Null;
  except
    on E: Exception do
    begin
      //AddLog(logimport, 'error writing property ' + propname + ' : ' + E.Message);
      Raise;
    end;
  end;
end;

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:QC20N
ID: 23742891
Can I find "businessRoles" with AD explorer?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23742920
only when it's filled it using that WriteProperty
AdExplorer doesn't show it unless filled in

0
 

Author Comment

by:QC20N
ID: 23743082
Ahh, ok. How did you find that there were a field to this?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23743109
i used the ad.msc plugin to look in the schema for all possible attributes

actually you can find all possible attributes of a computer using search container in AdExp
set the class to computer and then the attributes are in the second combo
0
 

Author Comment

by:QC20N
ID: 23743184
I tried what you are saying, but I can't find "businessRoles". :( Both with ad.msc and AD Exp.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23743200
then infra/microsoft must have done something to our forest to make this attribute available

did you look in the lower area of the 2nd search combobox in AdExp ?
the lowercase attribs are lower done ...
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23743210
here ...
screenshot.png
0
 

Author Comment

by:QC20N
ID: 23743255
I don't have it.
:(
SC.JPG
0
 

Author Comment

by:QC20N
ID: 23743483
What is format of businessRoles. maybe I can find something similar.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23743800
maybe it only displays the item if a value is filled in somewhere
it's an octetstring
have you tried writing in it ?
0
 

Author Comment

by:QC20N
ID: 23746359
I have tried what you ask me to do and it seems that the attribut dosen't exists.
BusinessRole.JPG
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23746389
gues the microsoft guys who were here last year actually did do something ...
you'll have to ask microsoft then
0
 

Author Comment

by:QC20N
ID: 23746483
But can you tell what format the BusinessRole has? You know, like LastLogonTimeStamp has Integer8.
0
 

Author Comment

by:QC20N
ID: 23747452
I think the format for the BusinessRole is a string or is that not true.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23752926
it's an octetstring
0
 

Author Comment

by:QC20N
ID: 23753839
I have looked at this and found that the "businessCategory" is not in use in our firm, but the only way I have found this was using ad.msc plug-in and then clic on the Computer class. Could you tell me how I use the the Attributes container? How do I know wich attributes belongs to "computer class"?
0
 

Author Closing Comment

by:QC20N
ID: 31550571
excellent solution
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question