Solved

Creating Organizational Units

Posted on 2004-09-07
5
463 Views
Last Modified: 2010-04-05
How do you create Organizational Units through Active Directory?  Also how do you assign members to the Organizational Units?  
0
Comment
Question by:edwardsr
5 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 11999031
seems you got this in the wrong category... anyway...
read on:
http://support.microsoft.com/default.aspx?scid=kb;en-us;324743
0
 

Expert Comment

by:scholzfree
ID: 12006174
0
 

Author Comment

by:edwardsr
ID: 12010354
I figured out how to create the users and orginanzational units using the "Active DS Type Library."  

How do I assign the users as well as other OU's to an OU?

function GetComputerName: String;   ///   Returns the computer Name   ///
var
  buffer : array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
  Size : Cardinal;
begin
  Size := Max_COMPUTERNAME_LENGTH + 1;
  Windows.GetComputerName(@buffer,Size);
  Result := StrPas(buffer);
end;

function GetDomainName : string;    ///   returns the Domain Name   ///
var
  err : Integer;
  buf : pointer;
  fDomainName: string;
  wServerName : WideString;
begin
  wServerName := GetComputerName;
  err := NetServerGetInfo (PWideChar (wServerName), 503, buf);
  if err = 0 then
    try
      fDomainName := PSERVER_INFO_503 (buf)^.sv503_domain;
    finally
      NetAPIBufferFree (buf)
  end;
      result := fDomainName;
end;


procedure TfrmNTRS.btnCreateAccountClick(Sender: TObject);
  ///   Creates the Organiztional units   ///
var
  Comp : IADsContainer;
  OrgUnit : IADsOU;
begin
  GetDomainName;
  try
    comp := GetObject('LDAP://' + GetDomainName) As IADsContainer;
    OrgUnit := comp.Create('OrganizationalUnit', 'OU=' + leClassName.Text) As IADsOu;
    OrgUnit.SetInfo;
  Except On E: EOleException Do
    Begin
      ShowMessage(E.Message);
    End;
  End;
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 12271158
Closed, 125 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

785 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