Active Directory Service Interfaces (ADSI)のお勉強

何が出来るか、お勉強中…


参考書
 ADSI ASPプログラミング―次世代標準ディレクトリサービスAPI ADSI入門    Programmer’s SELECTION
 サーバー管理者のためのイベントログ運用の基本
 Windowsサーバー Hacks ― 管理者必携のテクニック & WSHスクリプト 100選

 Windowsサーバークックブック― ネットワーク管理者のためのレシピ集
 この本は微妙…
  管理およびスクリプト ツール http://www.microsoft.com/resources/documentation/WindowsServ/2003/standard/proddocs/ja-jp/Default.asp?url=/resources/documentation/WindowsServ/2003/standard/proddocs/ja-jp/strategies_and_tools.asp
                http://www.microsoft.com/resources/documentation/WindowsServ/2003/enterprise/proddocs/ja-jp/Default.asp?url=/resources/documentation/WindowsServ/2003/enterprise/proddocs/ja-jp/strategies_and_tools.asp
  スクリプト センター     http://www.microsoft.com/japan/technet/scriptcenter/default.mspx
 の方が役に立つかも。


ここに表示しているソースは IIS の ASP。

利用できる Namespaces を確認。 -------------------------------------------------------------------------- Set ComputerObj = GetObject("ADs://") Response.Write ComputerObj.Name & "<br>" For Each Child In ComputerObj Response.Write Child.Name & "<br>" Next -------------------------------------------------------------------------- 結果 ADs: WinNT: NWCOMPAT: NDS: LDAP: IIS: ADSI Service Providers
WinNT:DOMAIN で情報を見る。DOMAIN 部分は環境に合わせて変更。 -------------------------------------------------------------------------- On Error Resume Next Const strDOMAIN = "DOMAIN" Set DomainObj = GetObject("WinNT://" & strDOMAIN) 'WinNT ADsPath ' IADs Property Methods ' Name オブジェクトの名前 ' ADsPath オブジェクトの ADsPath 文字列。 ' Class オブジェクトのスキーマクラス名 ' GUID プロバイダ固有で一意のオブジェクト識別子。無い場合もある。 ' Parent オブジェクトの親コンテナの ADsPath ' Schema このオブジェクトのスキーマクラスを表すオブジェクトの ADsPath Response.Write DomainObj.Name & ": " Response.Write DomainObj.Class & "<br>" For Each Member In DomainObj Response.Write Member.Name & ": " Response.Write Member.Class & "<br>" For Each Child In Member Response.Write Child.Name & ": " Response.Write Child.Class & "<br>" Next Next -------------------------------------------------------------------------- 結果 DOMAIN: Domain Schema: Schema Domain: Class Computer: Class User: Class Group: Class Service: Class FileService: Class Session: Class Resource: Class FileShare: Class FPNWFileService: Class FPNWSession: Class FPNWResource: Class FPNWFileShare: Class PrintQueue: Class PrintJob: Class Boolean: Syntax Counter: Syntax ADsPath: Syntax EmailAddress: Syntax FaxNumber: Syntax Integer: Syntax Interval: Syntax List: Syntax NetAddress: Syntax OctetString: Syntax Path: Syntax PhoneNumber: Syntax PostalAddress: Syntax SmallInterval: Syntax String: Syntax Time: Syntax MinPasswordLength: Property MinPasswordAge: Property MaxPasswordAge: Property MaxBadPasswordsAllowed: Property PasswordHistoryLength: Property AutoUnlockInterval: Property LockoutObservationInterval: Property Owner: Property Division: Property OperatingSystem: Property OperatingSystemVersion: Property Processor: Property ProcessorCount: Property Description: Property FullName: Property AccountExpirationDate: Property PasswordAge: Property UserFlags: Property LoginWorkstations: Property BadPasswordAttempts: Property MaxLogins: Property MaxStorage: Property PasswordExpired: Property PasswordExpirationDate: Property LastLogin: Property LastLogoff: Property HomeDirectory: Property Profile: Property Parameters: Property HomeDirDrive: Property LoginScript: Property LoginHours: Property PrimaryGroupID: Property objectSid: Property RasPermissions: Property groupType: Property HostComputer: Property DisplayName: Property ServiceType: Property StartType: Property Path: Property ErrorControl: Property LoadOrderGroup: Property ServiceAccountName: Property Dependencies: Property Version: Property MaxUserCount: Property User: Property Computer: Property ConnectTime: Property IdleTime: Property LockCount: Property CurrentUserCount: Property PrinterPath: Property PrinterName: Property Model: Property Datatype: Property PrintProcessor: Property ObjectGUID: Property Action: Property Location: Property StartTime: Property UntilTime: Property DefaultJobPriority: Property JobCount: Property Priority: Property Attributes: Property BannerPage: Property PrintDevices: Property HostPrintQueue: Property TimeSubmitted: Property TotalPages: Property Size: Property Notify: Property TimeElapsed: Property PagesPrinted: Property Position: Property ADSI Objects of WinNT
Filter を使って、Property だけ表示してみる。 -------------------------------------------------------------------------- On Error Resume Next Const strDOMAIN = "DOMAIN" Set DomainObj = GetObject("WinNT://" & strDOMAIN) For Each Member In DomainObj strFilter = Array("Property") Member.Filter = strFilter For Each Child In Member Response.Write Child.Name & ": " Response.Write Child.Class & "<br>" Next Next -------------------------------------------------------------------------- 結果 MinPasswordLength: Property MinPasswordAge: Property MaxPasswordAge: Property MaxBadPasswordsAllowed: Property PasswordHistoryLength: Property AutoUnlockInterval: Property LockoutObservationInterval: Property Owner: Property Division: Property OperatingSystem: Property OperatingSystemVersion: Property Processor: Property ProcessorCount: Property Description: Property FullName: Property AccountExpirationDate: Property PasswordAge: Property UserFlags: Property LoginWorkstations: Property BadPasswordAttempts: Property MaxLogins: Property MaxStorage: Property PasswordExpired: Property PasswordExpirationDate: Property LastLogin: Property LastLogoff: Property HomeDirectory: Property Profile: Property Parameters: Property HomeDirDrive: Property LoginScript: Property LoginHours: Property PrimaryGroupID: Property objectSid: Property RasPermissions: Property groupType: Property HostComputer: Property DisplayName: Property ServiceType: Property StartType: Property Path: Property ErrorControl: Property LoadOrderGroup: Property ServiceAccountName: Property Dependencies: Property Version: Property MaxUserCount: Property User: Property Computer: Property ConnectTime: Property IdleTime: Property LockCount: Property CurrentUserCount: Property PrinterPath: Property PrinterName: Property Model: Property Datatype: Property PrintProcessor: Property ObjectGUID: Property Action: Property Location: Property StartTime: Property UntilTime: Property DefaultJobPriority: Property JobCount: Property Priority: Property Attributes: Property BannerPage: Property PrintDevices: Property HostPrintQueue: Property TimeSubmitted: Property TotalPages: Property Size: Property Notify: Property TimeElapsed: Property PagesPrinted: Property Position: Property IADsMembers Property Methods
DOMAIN オブジェクトがサポートしているプロパティリストを表示 -------------------------------------------------------------------------- On Error Resume Next Const strDOMAIN = "DOMAIN" Set DomainObj = GetObject("WinNT://" & strDOMAIN) Set TargetClass = GetObject(Domain.Schema) Response.Write "Class Name : " & TargetClass.Name & "<br>" Response.Write "Class GUID : " & TargetClass.GUID & "<br>" Response.Write "Class CLSID: " & TargetClass.CLSID & "<br>" Response.Write "Container  : " & TargetClass.Container & "<br>" Response.Write "[Containment]<br>" For Each Member In TargetClass.Containment Response.Write " " & Member & "<br>" Next Response.Write "[MandatoryProperties]<br>" For Each Member In TargetClass.MandatoryProperties Response.Write " " & Member & "<br>" Next Response.Write "[OptionalProperties]<br>" For Each Member In TargetClass.OptionalProperties Response.Write " " & Member & "<br>" Next -------------------------------------------------------------------------- 結果 Class Name : Domain Class GUID : {6DC32211-4D19-11CF-9E74-000000000000} Class CLSID: {01544ED0-FD16-11CE-ABC4-000000000000} Container : True [Containment] Computer User Group [MandatoryProperties] [OptionalProperties] MinPasswordLength MinPasswordAge MaxPasswordAge MaxBadPasswordsAllowed PasswordHistoryLength AutoUnlockInterval LockoutObservationInterval IADsClass
ASP の方にログのパス調べるコードを少し書いてます。
資料  Active Directory テクノロジの背景  ADSI Scriptomatic  Active Directory Service Interfaces (英語)  ADSI リファレンス  Windows ADSI リファレンス  IIS の ADSI オブジェクト階層  IIsWebService (ADSI)  IGMP ルーター設定を構成するには  演習 1 : 一般的なツール セットを使用してシステムを管理する  演習 2 : 情報を構成する  演習 3 : IIS メタベースからデータを構成する [ADSI プログラミング] Active Directory – コマンドライン ツールを使ってみよう ! - 2 http://blogs.technet.com/jpilmblg/archive/2009/03/17/adsi-programming-_2D00_-_48FF4FFF57FF54FF4FFF_-_3A00_-papa090317.aspx