'ADSI'에 해당되는 글 5건
- 2008/04/22 ADSI를 이용해 속성값을 쓸때 생기는 0x8000500D 에러 (4)
- 2007/11/09 Windows Scripting를 이용해 AD에 LDAP과 ADSI를 이용한 사용자 추가
- 2007/09/06 Active directory how to
- 2007/09/06 Active Directory ㅠ_ㅠ
- 2007/09/05 Active directory 제어
이 문제는 ADSI를 이용해 Active Directory 속성값에 접근할 때 생깁니다.
이런 에러가 나는 주요 원인은 Exchange 등의 AD Schema가 확장되어있던 위치에서 작성된 코드를 확장되지 않은 AD에 실행하게되면 이와 같이 확장속성이 없는데 접근하려 하여서 에러가나는 경우를 확인 하엿습니다. 이런 경우 E_ADS_PROPERTY_NOT_FOUND 메시지를 보내고 이 코드값으로 0x8000500D을 반환하게 됩니다.
HTTP/1.1 200 OK
Via: 1.1 DHCP
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 52
Date: Wed, 16 Apr 2008 07:50:32 GMT
Content-Type: text/xml; charset=euc-kr
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
<DATA>예외가 발생한 HRESULT: 0x8000500D</DATA>
자세한 내용은 아래 Microsoft 기술문서 167695번을 확인하세요
PRB: Exception 0x8000500D When Querying a Property Using ADSI
'System > Server' 카테고리의 다른 글
| Exchange 2010 In-depth seminar (0) | 2009/09/02 |
|---|---|
| ADSI를 이용해 속성값을 쓸때 생기는 0x8000500D 에러 (4) | 2008/04/22 |
| Windows Server 2008 관련 문서 (0) | 2008/04/16 |
| IIS에서 401.x HTTP 에러 분석 / 상태코드 정보 (0) | 2007/12/01 |
-
-
써니루루 2008/07/14 17:05
죄송하지만 ASP에 대해서는 제가 지식이 부족해서 올릴만한 능력이 안되네요 ㅎㅎ
ADSI에 관해서는 관련 내용을 전문적으로 집대성하지는 않고 제가 문제상황을 보게되면 조금씩 정리하게 될것같습니다.
-
-
Windows Scripting과 ADSI 인터페이스를 이용해 LDAP 프로토콜을 이용하여 AD에 사용자를 추가하는 간단한 코드를 다음과 같이 수행해 보았다.
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & _
objRootDSE.Get("defaultNamingContext"))For i = 1 To 1000
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.SetInfo
NextWscript.Echo "1000 Users created."
실행 :
cmd> cscript Add1000Account.vbs
참고주소 : http://www.microsoft.com/technet/scriptcenter/guide/sas_ads_overview.mspx?mfr=true
이와 같은 스크립팅을 잘 이용하면 꽤 쓸만한 일을 해낼 수 있을듯 ..
좀 더 연구해 봐야겠다 ;;
2007/09/06 - [.NET/MOSS] - Active Directory ㅠ_ㅠ
2007/09/05 - [.NET/MOSS] - Active directory 제어
'.NET' 카테고리의 다른 글
| 메신져의 현재상태 정보 출력기능 위한 Client side API NameCtrl (1) | 2007/12/11 |
|---|---|
| MS 자격증 MCP 시험 One+One 2 Shot 서비스 안내 (0) | 2007/11/13 |
| Windows Scripting를 이용해 AD에 LDAP과 ADSI를 이용한 사용자 추가 (0) | 2007/11/09 |
| MS .NET FrameWork 공개 (0) | 2007/10/31 |
| Active Directory User/Group Encapsulation Classes (0) | 2007/09/16 |
| MOSS + AJAX + A tinkle of Imagination = Endless Web 2.0 Possibilities (0) | 2007/07/19 |
In our previous article, How to get full name of logged in user, we showed how you can get full name of a user in a given domain or machine. You can extend that idea to obtain any information you want for a given user. This artcile will describe how you can add a new user account into your domain or machine using .Net DirectoryServices classes. We will be using WinNT provider for illustrations in this article. But you can extend the examples to use LDAP or AD providers.
Details
Here are the key steps that you will need to perform to create new account.
- Create a new
DirectoryEntryobject and specify the machine name as the path. - User accounts are created as nodes corrresponding to User schema class in Active Directory. Therefore we will add a new
DirectoryEntryobject inChildrencollection of the machine. The key thing to rememeber will be that when you add new entry, make sure that the schema class name is User. - When you add a new node in
Childrencollection, it will return you the newly created object. At this stage the information has not been added to your machine or active directory tree. - Now you can set all the values that you need to set for a given account. Following is the list of property names that you can set for the account.
UserFlagsMaxStoragePasswordAgePasswordExpiredLoginHoursFullNameDescriptionBadPasswordAttemptsLastLoginHomeDirectoryLoginScriptProfileHomeDirDriveParametersPrimaryGroupIDNameMinPasswordLengthMaxPasswordAgeMinPasswordAgePasswordHistoryLengthAutoUnlockIntervalLockoutObservationIntervalMaxBadPasswordsAllowedRasPermissionsobjectSid
For more information on these properties please read Active Directory Services Interface(ADSI) section in Microsoft Platform SDK.
- You must have noticed from the above list that there is no property to set or get user password value. Operating system does not give access to clear text password value. So we can't expect and property or method to get it. In ADSI,
IAdsUserinterface providesSetPasswordmethod to set a user's password. This is whereInvokemethod ofDirectoryEntryclass comes handy. So we callInvoketo set the password value. TheInvokemethod can be used to call native methods on underlying active directory objects. There is one important thing to remeber when you set a user's password value. If you are using LDAP provider, then the user account should already have been created in the system by callingCommitChangesorSetInfomethod. But WinNT provider does not have this restriction. You can set password value without commiting the changes first. - The last step would be to actually create the account in the machine or domain. This is done by calling
CommitChangesmethod on newly addedDirectoryEntryobject.
The following code demonstrates all the steps that we described above.
private void AddUser(string strDoamin, string strLogin, string strPwd)
{
DirectoryEntry obDirEntry = null;
try
{
obDirEntry = new DirectoryEntry("WinNT://" + strDoamin);
DirectoryEntries entries = obDirEntry.Children;
DirectoryEntry obUser = entries.Add(strLogin, "User");
obUser.Properties["FullName"].Add("Amigo");
object obRet = obUser.Invoke("SetPassword", strPwd);
obUser.CommitChanges();
}
catch (Exception ex)
{
Trace.Warn(ex.Message);
}
}
Please feel free
'Microsoft > SPS/MOSS' 카테고리의 다른 글
| Active Directory를 이용한 Form Authentication의 접근 방향 (0) | 2007/09/11 |
|---|---|
| MOSS Form based authentication (0) | 2007/09/07 |
| Active directory how to (0) | 2007/09/06 |
| Active Directory ㅠ_ㅠ (0) | 2007/09/06 |
| MOSS 테크넷 (0) | 2007/09/05 |
| Active directory 제어 (0) | 2007/09/05 |
http://msdn2.microsoft.com/en-us/library/aa772218.aspx
Active Directory Service Interfaces(ADSI) Reference
http://msdn2.microsoft.com/en-us/library/aa367008.aspx
Lightweight Directory Access Protocol(LDAP)
Active Dirctory를 이용한 경로 정보 전체보기
//-----------------------------------------------------------------------
// This file is part of the Microsoft .NET Framework SDK Code Samples.
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//This source code is intended only as a supplement to Microsoft
//Development Tools and/or on-line documentation. See these other
//materials for detailed information regarding Microsoft code samples.
//
//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//PARTICULAR PURPOSE.
//-----------------------------------------------------------------------
using System;
using System.DirectoryServices;
using System.Security.Permissions;
using System.Runtime.InteropServices;
namespace Microsoft.Samples
{
public sealed class ADRead
{
private ADRead() {}
public static void Main(String[] args)
{
if(args.Length!=1)
{
Console.WriteLine("Usage: " + Environment.GetCommandLineArgs()[0] + " <ad_path>");
Console.WriteLine ();
Console.WriteLine ("Press Enter to continue...");
Console.ReadLine();
return;
}
DirectoryEntry objDirEnt=new DirectoryEntry(args[0]);
Console.WriteLine("Name = " + objDirEnt.Name);
Console.WriteLine("Path = " + objDirEnt.Path);
Console.WriteLine("SchemaClassName = " + objDirEnt.SchemaClassName);
Console.WriteLine("");
Console.WriteLine("Properties:");
foreach(String Key in objDirEnt.Properties.PropertyNames)
{
Console.Write("\t{0} = ", Key);
Console.WriteLine("");
foreach(Object objValue in objDirEnt.Properties[Key])
{
Console.WriteLine("\t\t{0}", objValue);
}
}
}
}
}
'Microsoft > SPS/MOSS' 카테고리의 다른 글
| MOSS Form based authentication (0) | 2007/09/07 |
|---|---|
| Active directory how to (0) | 2007/09/06 |
| Active Directory ㅠ_ㅠ (0) | 2007/09/06 |
| MOSS 테크넷 (0) | 2007/09/05 |
| Active directory 제어 (0) | 2007/09/05 |
| MOSS Custom 검색을 위한 Webpart를 만들기 위한 예제 코드 (0) | 2007/09/01 |
MOSS.. 아 짜증.. Active directory를 코딩으로 제어해야한다.. 된장..
'Microsoft > SPS/MOSS' 카테고리의 다른 글
| Active Directory ㅠ_ㅠ (0) | 2007/09/06 |
|---|---|
| MOSS 테크넷 (0) | 2007/09/05 |
| Active directory 제어 (0) | 2007/09/05 |
| MOSS Custom 검색을 위한 Webpart를 만들기 위한 예제 코드 (0) | 2007/09/01 |
| MOSS SharePoint Server 2007 SDK (0) | 2007/08/30 |
| MOSS SmartPart (0) | 2007/08/28 |


Prev




