[ Team LiB ] |
Recipe 12.12 Viewing Object Metadata12.12.1 ProblemYou want to view metadata for an object. The object's replPropertyMetaData attribute stores metadata information about the most recent updates to every attribute that has been set on the object. 12.12.2 Solution12.12.2.1 Using a graphical user interface
12.12.2.2 Using a command-line interfaceIn the following command, replace <ObjectDN> with the distinguished name of the object for which you want to view metadata: > repadmin /showobjmeta <DomainControllerName> <ObjectDN> This command was called /showmeta in the Windows 2000 version of repadmin. Also, the parameters are switched in that version, where <ObjectDN> comes before <DomainControllerName>. 12.12.2.3 Using VBScript' This code displays the meta data for the specified object. ' ------ SCRIPT CONFIGURATION ------ strObjectDN = "<ObjectDN>" ' e.g. dc=rallencorp,dc=com strDC = "<DomainControllerName>" ' e.g. dc1 ' ------ END CONFIGURATION --------- set objIadsTools = CreateObject("IADsTools.DCFunctions") intRes = objIadsTools.GetMetaData(Cstr(strDC),Cstr(strObjectDN),0) if intRes = -1 then Wscript.Echo objIadsTools.LastErrorText WScript.Quit end if for count = 1 to intRes WScript.Echo count & ". " & objIadsTools.MetaDataName(count) WScript.Echo vbTab & " Version: " & _ objIadsTools.MetaDataVersionNumber(count) WScript.Echo vbTab & " Last Write: " & _ objIadsTools.MetaDataLastWriteTime(count) WScript.Echo vbTab & " Local USN: " & _ objIadsTools.MetaDataLocalUSN(count) WScript.Echo vbTab & " Source USN: " & _ objIadsTools.MetaDataSourceUSN(count) WScript.Echo vbTab & " Server: " & _ objIadsTools.MetaDataServerName(count) next 12.12.3 DiscussionObject metadata can be an invaluable source of information when you need to troubleshoot replication problems or find out the last time an attribute was set for a particular object. In fact, a quick way to determine if two domain controllers have the same copy of an object is to look at the metadata on both servers for the object. If they both have the same metadata, then they have the same version of the object. Unfortunately, the replPropertyMetaData attribute is stored as an octet string, so you cannot simply read the attribute to view all of the metadata information. In the VBScript solution, the IADsTool GetMetaData method is a wrapper around the DsReplicaGetInfo method call. This method understands the format of the replPropertyMetaData attribute and can return it into a readable format. The following data is stored for each attribute that has been set on the object:
12.12.4 See AlsoSee IadsTools.doc in the Support Tools for more information on the IADsTools interface |
[ Team LiB ] |