IVssBackupComponents::GetWriterMetadata method (vsbackup.h)

The GetWriterMetadata method returns the metadata for a specific writer running on the system.


HRESULT GetWriterMetadata(
  [in]  UINT                      iWriter,
  [out] VSS_ID                    *pidInstance,
  [out] IVssExamineWriterMetadata **ppMetadata


[in] iWriter

Index of the writer whose metadata is to be retrieved. The value of this parameter is an integer from 0 to n–1 inclusive, where n is the total number of writers on the current system. The value of n is returned by IVssBackupComponents::GetWriterMetadataCount.

[out] pidInstance

Pointer to the instance identifier of the writer that collected the metadata.

[out] ppMetadata

Doubly indirect pointer to the instance of the IVssExamineWriterMetadata object that contains the returned metadata.

Return value

The following are the valid return codes for this method.

Value Meaning
Successfully returned a pointer to an IVssExamineWriterMetadata interface object.
One of the parameter values is not valid.
The caller is out of memory or other system resources.
The backup components object is not initialized, this method has been called during a restore operation, or this method has not been called within the correct sequence.
The XML document is not valid. Check the event log for details. For more information, see Event and Error Handling Under VSS.
The specified shadow copy does not exist.
Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.

Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This value is not supported until Windows Server 2008 R2 and Windows 7. E_UNEXPECTED is used instead.


A requester must call the asynchronous operation IVssBackupComponents::GatherWriterMetadata and wait for it to complete prior to calling GetWriterMetadata.

Although IVssBackupComponents::GatherWriterMetadata must be called prior to either a restore or backup operation, GetWriterMetadata is not typically called for restores.

Component information retrieved (during backup operations) using IVssExamineWriterMetadata::GetComponent, where the IVssExamineWriterMetadata interface has been returned by GetWriterMetadata, comes from the Writer Metadata Document of a live writer process.

This is in contrast to the information returned by GetWriterComponents (during restore operations), which was stored in the Backup Components Document by calls to AddComponent.

When the caller of this method is finished accessing the metadata, it must call IUnknown::Release.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header vsbackup.h (include VsBackup.h, Vss.h, VsWriter.h)
Library VssApi.lib

See also