AD DS への TPM 回復情報のバックアップ
IT 担当者向けのこのトピックでは、コンピューターのトラステッド プラットフォーム モジュール (TPM) の情報を Active Directory ドメイン サービス (AD DS) にバックアップして、AD DS を使ってリモート コンピューターから TPM を管理できるようにする方法について説明します。
TPM をリモートで管理する方法
コンピューターの TPM 所有者情報をバックアップすると、ドメインの管理者はローカル コンピューター上の TPM セキュリティ ハードウェアをリモートで構成できます。たとえば、コンピューターの使用を停止したり用途を変更したりする場合、そのコンピューターの前にいなくても、TPM を製造元の既定値にリセットすることができます。
TPM 所有者がパスワードを忘れたり TPM の管理を行う必要があったりする回復の状況で使う TPM 所有者情報を格納するために、AD DS を使うことができます。TPM 所有者パスワードはコンピューターごとに 1 つだけがあります。そのため、TPM 所有者パスワードのハッシュは、AD DS でコンピューター オブジェクトの属性として格納できます。この属性には共通名 (CN) ms-TPM-OwnerInformation が含まれます。
注
TPM 所有者認証値は AD DS に格納され、base 64 エンコードである TPM 所有者パスワードの SHA-1 ハッシュとして TPM 所有者パスワード ファイル内に存在します。実際の所有者パスワードは格納されません。
既定で、Windows Server 2012 R2 または Windows Server 2012 を実行するドメイン コントローラーには必要な AD DS スキーマ オブジェクトが含まれます。ただし、ドメイン コントローラーで Windows Server 2008 R2 を実行している場合は、「TPM バックアップをサポートするための AD DS スキーマ拡張機能」で説明するように、スキーマを更新する必要があります。
このトピックには、リモート コンピューター上で TPM の情報を回復したり TPM の使用を停止したりするための手順が含まれます。その一部は、Visual Basic スクリプトに依存します。サンプル スクリプトが用意されていますが、環境の要件を満たすためにカスタマイズしても構いません。
このトピックの内容:
前提条件の状態の確認
パスワード情報をバックアップするアクセス許可の設定
AD DS 内の TPM 回復情報をバックアップするグループ ポリシーの構成
AD DS を使った TPM 情報の回復
サンプル スクリプト
前提条件の状態の確認
バックアップを開始する前に、次の前提要件を満たしていることを確認します。
TPM サービスを使うクライアント コンピューターでアクセスできるすべてのドメイン コントローラーは、更新されたスキーマを使って、Windows Server 2012 R2、Windows Server 2012、または Windows Server 2008 R2 を実行している。
ヒント
Windows Server 2008 R2 を実行している Active Directory ドメイン内の TPM バックアップに必要なスキーマ拡張機能について詳しくは、「TPM バックアップをサポートするための AD DS スキーマ拡張機能」をご覧ください。
ターゲット フォレストでドメイン管理者の権限があるか、ターゲット フォレストのスキーマを拡張する適切なアクセス許可が与えられているアカウントを使っている。Enterprise Admins グループまたは Schema Admins グループのメンバーは、適切なアクセス許可を持つアカウントの例です。
パスワード情報をバックアップするアクセス許可の設定
この手順では、サンプル スクリプト Add-TPMSelfWriteACE.vbs を使い、TPM 回復情報をバックアップできるようにアクセス制御エントリ (ACE) を追加します。クライアント コンピューターは、この ACE が追加されるまで、TPM 所有者情報をバックアップできません。
このスクリプトは TPM 回復情報の管理に使うドメイン コントローラーで実行し、次の前提条件の下で動作します。
ユーザーに、最上位のドメイン オブジェクトのアクセス許可を設定するためのドメイン管理者の資格情報がある。
ターゲット ドメインは、スクリプトを実行しているユーザー アカウントのドメインと同じである。たとえば、TESTDOMAIN\admin としてスクリプトを実行するには、TESTDOMAIN のアクセス許可を拡張します。
注
複数のドメインのアクセス許可を設定したいが、それらのドメインごとにドメイン管理者アカウントがない場合は、サンプル スクリプトを変更する必要があります。スクリプトで変数 strPathToDomain を探し、ターゲット ドメインのこの変数を変更します。例:
LDAP://DC=testdomain,DC=nttest,DC=microsoft,DC=com
最上位のドメイン オブジェクトから対象となるコンピューター オブジェクトにアクセス許可が継承されるように、ドメインが構成されている。
階層内の任意のコンテナーが継承されたアクセス許可を許可していない場合、アクセス許可は有効になりません。既定では、アクセス許可の継承は AD DS で設定されています。この既定が現在の構成と異なるかどうかがわからない場合は、セットアップ手順を続行してアクセス許可を設定することができます。その後、このトピックの後半で説明するように、構成を確認できます。または、コンピューター オブジェクトのプロパティを表示しているときに [有効なアクセス許可] ボタンをクリックし、msTPM-OwnerInformation 属性を書き込むように Self が承認されていることを確認できます。
TPM 回復情報のバックアップを許可するように ACE を追加するには
サンプル スクリプト Add-TPMSelfWriteACE.vbs を開きます。
スクリプトには、アクセス許可の拡張機能が含まれます。ドメイン名を使って strPathToDomain の値を変更する必要があります。
スクリプトに変更を保存します。
コマンド プロンプトで次のコマンドを入力し、Enter キーを押します。
cscript Add-TPMSelfWriteACE.vbs
このスクリプトは、最上位のドメイン オブジェクトに 1 つの ACE を追加します。ACE は、コンピューター (SELF) がドメイン内のコンピューター オブジェクトの ms-TPM-OwnerInformation 属性に書き込みできる継承可能なアクセス許可です。
次の手順を実行して適切なアクセス許可が設定されていることを確認し、必要な場合は最上位のドメインから TPM と BitLocker の ACE を削除します。
TPM スキーマ オブジェクトで構成されている ACE の管理
サンプル スクリプト List-ACEs.vbs を開きます。
List-ACEs.vbs を変更します。
次を必要があります。
strPathToDomain の値: ドメイン名を使います。
フィルター オプション: スクリプトでは、BitLocker と TPM スキーマ オブジェクトを処理するフィルターを設定します。そのため、その他のスキーマ オブジェクトを一覧表示または削除するには、If IsFilterActive () を変更する必要があります。
スクリプトに変更を保存します。
コマンド プロンプトで次のコマンドを入力し、Enter キーを押します。
cscript List-ACEs.vbs
このスクリプトを使い、最上位のドメインで BitLocker と TPM スキーマ オブジェクトから ACE を削除することもできます。
AD DS 内の TPM 回復情報をバックアップするグループ ポリシーの構成
この手順を使って、ローカル コンピューターで TPM グループ ポリシー設定 ポリシー設定を構成します。運用環境でこれを行う効率的な方法とは、ドメイン内のクライアント コンピューターを対象にできるグループ ポリシー オブジェクト (GPO) を作成または編集することです。
TPM 回復情報を AD DS にバックアップするローカル ポリシー設定を有効にするには
ローカルの Administrators グループのメンバーであるドメイン アカウントを使って、ドメインに参加しているコンピューターにサインインします。
ローカル グループ ポリシー エディター (gpedit.msc) を開き、"コンピューターの構成\管理用テンプレート\Windows コンポーネント\Internet Explorer" に移動します。
[トラステッド プラットフォーム モジュール サービス] をクリックします。
[Active Directory ドメイン サービスへの TPM バックアップを有効にする] をダブルクリックします。
[有効] をクリックし、[OK] をクリックします。
重要
この設定を有効にすると、コンピューターがドメインに接続されていて TPM 回復情報の AD DS バックアップが成功した場合を除き、TPM 所有者パスワードを設定または変更できません。
AD DS を使った TPM 情報の回復
TPM 所有者情報を AD DS から回復し、TPM を管理するために使う必要がある場合は、AD DS から ms-TPM-OwnerInformation オブジェクトを読み取り、TPM 所有者パスワードのバックアップ ファイルを手動で作成する必要があります。このファイルは、TPM 所有者の資格情報が必要なときに提供できます。
AD DS から TPM 所有者バックアップ情報を取得してパスワード ファイルを作成するには
ドメイン管理者の資格情報を使って、ドメイン コント ローラーにサインインします。
サンプル スクリプト ファイル Get TPMOwnerInfo.vbs をお使いのコンピューター上の場所にコピーします。
コマンド プロンプト ウィンドウを開き、前の手順で保存したサンプル スクリプト ファイルの場所を既定の場所に変更します。
コマンド プロンプトで、cscript Get-TPMOwnerInfo.vbs と入力します。
想定される出力は、先ほど作成したパスワードのハッシュである文字列です。
注
エラー メッセージ "Active Directory: ディレクトリのプロパティがキャッシュに見つかりません" を受け取った場合は、ms-TPM-OwnerInformation 属性を読み取るために必要なドメイン管理者アカウントを使っていることを確認します。
この要件の唯一の例外は、ユーザーがドメインに参加させるコンピューター オブジェクトの作成所有者である場合、そのユーザーはコンピューター オブジェクトの TPM 所有者情報を読み取れる可能性があるということです。
メモ帳または別のテキスト エディターを開き、ファイルに次のコード サンプルをコピーし、前の手順で記録した文字列で TpmOwnerPasswordHash を置き換えます。
<?xml version="1.0" encoding="UTF-8"?> <!-- This page is a backup of Trusted Platform Module (TPM) owner authorization information. Upon request, use the authorization information to prove ownership of the computer's TPM. IMPORTANT: Please keep this file in a secure location away from your computer's local hard drive. --> <tpmOwnerData version="1.0" softwareAuthor="Microsoft Windows [Version 6.1.7600]" creationDate="2009-11-11T14:39:29-08:00" creationUser="DOMAIN\username" machineName="mymachine"> <tpmInfo manufacturerId="1096043852"/> <ownerAuth>TpmOwnerPasswordHash</ownerAuth> </tpmOwnerData>
このファイルを USB フラッシュ ドライブなどのリムーバブル記憶装置に .tpm 拡張子で保存します。TPM にアクセスすると、TPM 所有者パスワードを入力するように要求されます。ファイルからパスワードを読み取るためのオプションを選択し、このファイルのパスを指定します。
サンプル スクリプト
次のサンプル スクリプトは前述の手順で使われます。これらのすべてまたは一部を使い、TPM 回復情報をバックアップするように AD DS を構成することができます。環境の構成に応じてカスタマイズが必要です。
Add-TPMSelfWriteACE.vbs: TPM のアクセス制御エントリ (ACE) を AD DS に追加するときに使います。
List-ACEs.vbs: BitLocker と TPM スキーマ オブジェクトで構成されている ACE を表示または削除するときに使います。
Get-TPMOwnerInfo.vbs: 特定のコンピューターについて AD DS から TPM 回復情報を取得するときに使います
Add-TPMSelfWriteACE.vbs
このスクリプトは、コンピューターが AD DS 内の TPM 回復情報をバックアップできるように、TPM のアクセス制御エントリ (ACE) を AD DS に追加します。
'===============================================================================
'
' This script demonstrates the addition of an Access Control Entry (ACE)
' to allow computers to write Trusted Platform Module (TPM)
' recovery information to Active Directory.
'
' This script creates a SELF ACE on the top-level domain object, and
' assumes that inheritance of ACL's from the top-level domain object to
' down-level computer objects are enabled.
'
'
'
' Last Updated: 12/05/2012
' Last Reviewed: 12/05/2012
' Microsoft Corporation
'
' Disclaimer
'
' The sample scripts are not supported under any Microsoft standard support program
' or service. The sample scripts are provided AS IS without warranty of any kind.
' Microsoft further disclaims all implied warranties including, without limitation,
' any implied warranties of merchantability or of fitness for a particular purpose.
' The entire risk arising out of the use or performance of the sample scripts and
' documentation remains with you. In no event shall Microsoft, its authors, or
' anyone else involved in the creation, production, or delivery of the scripts be
' liable for any damages whatsoever (including, without limitation, damages for loss
' of business profits, business interruption, loss of business information, or
' other pecuniary loss) arising out of the use of or inability to use the sample
' scripts or documentation, even if Microsoft has been advised of the possibility
' of such damages.
'
' Version 1.0.2 - Tested and re-released for Windows 8 and Windows Server 2012
'
'===============================================================================
' --------------------------------------------------------------------------------
' Access Control Entry (ACE) constants
' --------------------------------------------------------------------------------
'- From the ADS_ACETYPE_ENUM enumeration
Const ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = &H5 'Allows an object to do something
'- From the ADS_ACEFLAG_ENUM enumeration
Const ADS_ACEFLAG_INHERIT_ACE = &H2 'ACE can be inherited to child objects
Const ADS_ACEFLAG_INHERIT_ONLY_ACE = &H8 'ACE does NOT apply to target (parent) object
'- From the ADS_RIGHTS_ENUM enumeration
Const ADS_RIGHT_DS_WRITE_PROP = &H20 'The right to write object properties
Const ADS_RIGHT_DS_CREATE_CHILD = &H1 'The right to create child objects
'- From the ADS_FLAGTYPE_ENUM enumeration
Const ADS_FLAG_OBJECT_TYPE_PRESENT = &H1 'Target object type is present in the ACE
Const ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT = &H2 'Target inherited object type is present in the ACE
' --------------------------------------------------------------------------------
' TPM and FVE schema object GUID's
' --------------------------------------------------------------------------------
'- ms-TPM-OwnerInformation attribute
SCHEMA_GUID_MS_TPM_OWNERINFORMATION = "{AA4E1A6D-550D-4E05-8C35-4AFCB917A9FE}"
'- ms-FVE-RecoveryInformation object
SCHEMA_GUID_MS_FVE_RECOVERYINFORMATION = "{EA715D30-8F53-40D0-BD1E-6109186D782C}"
'- Computer object
SCHEMA_GUID_COMPUTER = "{BF967A86-0DE6-11D0-A285-00AA003049E2}"
'Reference: "Platform SDK: Active Directory Schema"
' --------------------------------------------------------------------------------
' Set up the ACE to allow write of TPM owner information
' --------------------------------------------------------------------------------
Set objAce1 = createObject("AccessControlEntry")
objAce1.AceFlags = ADS_ACEFLAG_INHERIT_ACE + ADS_ACEFLAG_INHERIT_ONLY_ACE
objAce1.AceType = ADS_ACETYPE_ACCESS_ALLOWED_OBJECT
objAce1.Flags = ADS_FLAG_OBJECT_TYPE_PRESENT + ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT
objAce1.Trustee = "SELF"
objAce1.AccessMask = ADS_RIGHT_DS_WRITE_PROP
objAce1.ObjectType = SCHEMA_GUID_MS_TPM_OWNERINFORMATION
objAce1.InheritedObjectType = SCHEMA_GUID_COMPUTER
' --------------------------------------------------------------------------------
' NOTE: BY default, the "SELF" computer account can create
' BitLocker recovery information objects and write BitLocker recovery properties
'
' No additional ACE's are needed.
' --------------------------------------------------------------------------------
' --------------------------------------------------------------------------------
' Connect to Discretional ACL (DACL) for domain object
' --------------------------------------------------------------------------------
Set objRootLDAP = GetObject("LDAP://rootDSE")
strPathToDomain = "LDAP://" & objRootLDAP.Get("defaultNamingContext") ' e.g. string dc=fabrikam,dc=com
Set objDomain = GetObject(strPathToDomain)
WScript.Echo "Accessing object: " + objDomain.Get("distinguishedName")
Set objDescriptor = objDomain.Get("ntSecurityDescriptor")
Set objDacl = objDescriptor.DiscretionaryAcl
' --------------------------------------------------------------------------------
' Add the ACEs to the Discretionary ACL (DACL) and set the DACL
' --------------------------------------------------------------------------------
objDacl.AddAce objAce1
objDescriptor.DiscretionaryAcl = objDacl
objDomain.Put "ntSecurityDescriptor", Array(objDescriptor)
objDomain.SetInfo
WScript.Echo "SUCCESS!"
List-ACEs.vbs
このスクリプトは、最上位のドメインの BitLocker と TPM スキーマ オブジェクトで構成されている ACE を一覧表示または削除します。これにより、想定されている ACE が適切に追加されていることを確認したり、必要な場合は BitLocker または TPM に関連する任意の ACE を削除したりすることができます。
'===============================================================================
'
' This script lists the access control entries (ACE's) configured on
' Trusted Platform Module (TPM) and BitLocker Drive Encryption (BDE) schema objects
' for the top-level domain.
'
' You can use this script to check that the correct permissions have been set and
' to remove TPM and BitLocker ACE's from the top-level domain.
'
'
' Last Updated: 12/05/2012
' Last Reviewed: 12/02/2012
'
' Microsoft Corporation
'
' Disclaimer
'
' The sample scripts are not supported under any Microsoft standard support program
' or service. The sample scripts are provided AS IS without warranty of any kind.
' Microsoft further disclaims all implied warranties including, without limitation,
' any implied warranties of merchantability or of fitness for a particular purpose.
' The entire risk arising out of the use or performance of the sample scripts and
' documentation remains with you. In no event shall Microsoft, its authors, or
' anyone else involved in the creation, production, or delivery of the scripts be
' liable for any damages whatsoever (including, without limitation, damages for loss
' of business profits, business interruption, loss of business information, or
' other pecuniary loss) arising out of the use of or inability to use the sample
' scripts or documentation, even if Microsoft has been advised of the possibility
' of such damages.
'
' Version 1.0.2 - Tested and re-released for Windows 8 and Windows Server 2012
'
'===============================================================================
' --------------------------------------------------------------------------------
' Usage
' --------------------------------------------------------------------------------
Sub ShowUsage
Wscript.Echo "USAGE: List-ACEs"
Wscript.Echo "List access permissions for BitLocker and TPM schema objects"
Wscript.Echo ""
Wscript.Echo "USAGE: List-ACEs -remove"
Wscript.Echo "Removes access permissions for BitLocker and TPM schema objects"
WScript.Quit
End Sub
' --------------------------------------------------------------------------------
' Parse Arguments
' --------------------------------------------------------------------------------
Set args = WScript.Arguments
Select Case args.Count
Case 0
' do nothing - checks for ACE's
removeACE = False
Case 1
If args(0) = "/?" Or args(0) = "-?" Then
ShowUsage
Else
If UCase(args(0)) = "-REMOVE" Then
removeACE = True
End If
End If
Case Else
ShowUsage
End Select
' --------------------------------------------------------------------------------
' Configuration of the filter to show/remove only ACE's for BDE and TPM objects
' --------------------------------------------------------------------------------
'- ms-TPM-OwnerInformation attribute
SCHEMA_GUID_MS_TPM_OWNERINFORMATION = "{AA4E1A6D-550D-4E05-8C35-4AFCB917A9FE}"
'- ms-FVE-RecoveryInformation object
SCHEMA_GUID_MS_FVE_RECOVERYINFORMATION = "{EA715D30-8F53-40D0-BD1E-6109186D782C}"
' Use this filter to list/remove only ACEs related to TPM and BitLocker
aceGuidFilter = Array(SCHEMA_GUID_MS_TPM_OWNERINFORMATION, _
SCHEMA_GUID_MS_FVE_RECOVERYINFORMATION)
' Note to script source reader:
' Uncomment the following line to turn off the filter and list all ACEs
'aceGuidFilter = Array()
' --------------------------------------------------------------------------------
' Helper functions related to the list filter for listing or removing ACE's
' --------------------------------------------------------------------------------
Function IsFilterActive()
If Join(aceGuidFilter) = "" Then
IsFilterActive = False
Else
IsFilterActive = True
End If
End Function
Function isAceWithinFilter(ace)
aceWithinFilter = False ' assume first not pass the filter
For Each guid In aceGuidFilter
If ace.ObjectType = guid Or ace.InheritedObjectType = guid Then
isAceWithinFilter = True
End If
Next
End Function
Sub displayFilter
For Each guid In aceGuidFilter
WScript.echo guid
Next
End Sub
' --------------------------------------------------------------------------------
' Connect to Discretional ACL (DACL) for domain object
' --------------------------------------------------------------------------------
Set objRootLDAP = GetObject("LDAP://rootDSE")
strPathToDomain = "LDAP://" & objRootLDAP.Get("defaultNamingContext") ' e.g. dc=fabrikam,dc=com
Set domain = GetObject(strPathToDomain)
WScript.Echo "Accessing object: " + domain.Get("distinguishedName")
WScript.Echo ""
Set descriptor = domain.Get("ntSecurityDescriptor")
Set dacl = descriptor.DiscretionaryAcl
' --------------------------------------------------------------------------------
' Show Access Control Entries (ACE's)
' --------------------------------------------------------------------------------
' Loop through the existing ACEs, including all ACEs if the filter is not active
i = 1 ' global index
c = 0 ' found count - relevant if filter is active
For Each ace In dacl
If IsFilterActive() = False or isAceWithinFilter(ace) = True Then
' note to script source reader:
' echo i to show the index of the ACE
WScript.echo "> AceFlags: " & ace.AceFlags
WScript.echo "> AceType: " & ace.AceType
WScript.echo "> Flags: " & ace.Flags
WScript.echo "> AccessMask: " & ace.AccessMask
WScript.echo "> ObjectType: " & ace.ObjectType
WScript.echo "> InheritedObjectType: " & ace.InheritedObjectType
WScript.echo "> Trustee: " & ace.Trustee
WScript.echo ""
if IsFilterActive() = True Then
c = c + 1
' optionally include this ACE in removal list if configured
' note that the filter being active is a requirement since we don't
' want to accidentally remove all ACEs
If removeACE = True Then
dacl.RemoveAce ace
End If
end if
End If
i = i + 1
Next
' Display number of ACEs found
If IsFilterActive() = True Then
WScript.echo c & " ACE(s) found in " & domain.Get("distinguishedName") _
& " related to BitLocker and TPM" 'note to script source reader: change this line if you configure your own
filter
' note to script source reader:
' uncomment the following lines if you configure your own filter
'WScript.echo ""
'WScript.echo "The following filter was active: "
'displayFilter
'Wscript.echo ""
Else
i = i - 1
WScript.echo i & " total ACE(s) found in " & domain.Get("distinguishedName")
End If
' --------------------------------------------------------------------------------
' Optionally remove ACE's on a filtered list
' --------------------------------------------------------------------------------
if removeACE = True and IsFilterActive() = True then
descriptor.DiscretionaryAcl = dacl
domain.Put "ntSecurityDescriptor", Array(descriptor)
domain.setInfo
WScript.echo c & " ACE(s) removed from " & domain.Get("distinguishedName")
else
if removeACE = True then
WScript.echo "You must specify a filter to remove ACEs from " & domain.Get("distinguishedName")
end if
end if
Get-TPMOwnerInfo.vbs
このスクリプトは、特定のコンピューターについて AD DS から TPM 回復情報を取得して、ドメイン管理者 (または委任された役割) のみがバックアップされた TPM 回復情報を読み取ることができることを検証したり、情報が適切にバックアップされていることを検証したりできます。
'=================================================================================
'
' This script demonstrates the retrieval of Trusted Platform Module (TPM)
' recovery information from Active Directory for a particular computer.
'
' It returns the TPM owner information stored as an attribute of a
' computer object.
'
' Last Updated: 12/05/2012
' Last Reviewed: 12/05/2012
'
' Microsoft Corporation
'
' Disclaimer
'
' The sample scripts are not supported under any Microsoft standard support program
' or service. The sample scripts are provided AS IS without warranty of any kind.
' Microsoft further disclaims all implied warranties including, without limitation,
' any implied warranties of merchantability or of fitness for a particular purpose.
' The entire risk arising out of the use or performance of the sample scripts and
' documentation remains with you. In no event shall Microsoft, its authors, or
' anyone else involved in the creation, production, or delivery of the scripts be
' liable for any damages whatsoever (including, without limitation, damages for loss
' of business profits, business interruption, loss of business information, or
' other pecuniary loss) arising out of the use of or inability to use the sample
' scripts or documentation, even if Microsoft has been advised of the possibility
' of such damages.
'
' Version 1.0 - Initial release
' Version 1.1 - Updated GetStrPathToComputer to search the global catalog.
' Version 1.1.2 - Tested and re-released for Windows 8 and Windows Server 2012
'
'=================================================================================
' --------------------------------------------------------------------------------
' Usage
' --------------------------------------------------------------------------------
Sub ShowUsage
Wscript.Echo "USAGE: Get-TpmOwnerInfo [Optional Computer Name]"
Wscript.Echo "If no computer name is specified, the local computer is assumed."
WScript.Quit
End Sub
' --------------------------------------------------------------------------------
' Parse Arguments
' --------------------------------------------------------------------------------
Set args = WScript.Arguments
Select Case args.Count
Case 0
' Get the name of the local computer
Set objNetwork = CreateObject("WScript.Network")
strComputerName = objNetwork.ComputerName
Case 1
If args(0) = "/?" Or args(0) = "-?" Then
ShowUsage
Else
strComputerName = args(0)
End If
Case Else
ShowUsage
End Select
' --------------------------------------------------------------------------------
' Get path to Active Directory computer object associated with the computer name
' --------------------------------------------------------------------------------
Function GetStrPathToComputer(strComputerName)
' Uses the global catalog to find the computer in the forest
' Search also includes deleted computers in the tombstone
Set objRootLDAP = GetObject("LDAP://rootDSE")
namingContext = objRootLDAP.Get("defaultNamingContext") ' e.g. string dc=fabrikam,dc=com
strBase = "<GC://" & namingContext & ">"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
strFilter = "(&(objectCategory=Computer)(cn=" & strComputerName & "))"
strQuery = strBase & ";" & strFilter & ";distinguishedName;subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 100
objCommand.Properties("Cache Results") = False
' Enumerate all objects found.
Set objRecordSet = objCommand.Execute
If objRecordSet.EOF Then
WScript.echo "The computer name '" & strComputerName & "' cannot be found."
WScript.Quit 1
End If
' Found object matching name
Do Until objRecordSet.EOF
dnFound = objRecordSet.Fields("distinguishedName")
GetStrPathToComputer = "LDAP://" & dnFound
objRecordSet.MoveNext
Loop
' Clean up.
Set objConnection = Nothing
Set objCommand = Nothing
Set objRecordSet = Nothing
End Function
' --------------------------------------------------------------------------------
' Securely access the Active Directory computer object using Kerberos
' --------------------------------------------------------------------------------
Set objDSO = GetObject("LDAP:")
strPath = GetStrPathToComputer(strComputerName)
WScript.Echo "Accessing object: " + strPath
Const ADS_SECURE_AUTHENTICATION = 1
Const ADS_USE_SEALING = 64 '0x40
Const ADS_USE_SIGNING = 128 '0x80
Set objComputer = objDSO.OpenDSObject(strPath, vbNullString, vbNullString, _
ADS_SECURE_AUTHENTICATION + ADS_USE_SEALING + ADS_USE_SIGNING)
' --------------------------------------------------------------------------------
' Get the TPM owner information from the Active Directory computer object
' --------------------------------------------------------------------------------
strOwnerInformation = objComputer.Get("msTPM-OwnerInformation")
WScript.echo "msTPM-OwnerInformation: " + strOwnerInformation
その他の情報
トラステッド プラットフォーム モジュール テクノロジの概要
Windows PowerShell の TPM コマンドレット
TPM バックアップをサポートするための AD DS スキーマ拡張機能
BitLocker に向けた組織の準備: 計画とポリシー、TPM に関する考慮事項をご覧ください