IVssBackupComponents::AddToSnapshotSet method (vsbackup.h)
The AddToSnapshotSet method adds an original volume or original remote file share to the shadow copy set.
Syntax
HRESULT AddToSnapshotSet(
[in] VSS_PWSZ pwszVolumeName,
[in] VSS_ID ProviderId,
[out] VSS_ID *pidSnapshot
);
Parameters
[in] pwszVolumeName
Null-terminated wide character string containing the name of the volume or the UNC path of the remote file share to be shadow copied. The name or UNC path must be in one of the following formats and must include a trailing backslash (\):
- The path of a mounted folder, for example, Y:\MountX\
- A drive letter, for example, D:\
- A volume GUID path of the form \\?\Volume{GUID}\ (where GUID identifies the volume)
- A UNC path that specifies a remote file share, for example, \\Clusterx\Share1\
[in] ProviderId
The provider to be used. GUID_NULL can be used, in which case the default provider will be used.
[out] pidSnapshot
Returned identifier of the added shadow copy.
Return value
The following are the valid return codes for this method.
Value | Meaning |
---|---|
|
Successfully added the volume or remote file share to the shadow copy set. |
|
Caller does not have sufficient backup privileges or is not an administrator. |
|
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 maximum number of volumes or remote file shares have been added to the shadow copy set. The specified volume or remote file share was not added to the shadow copy set. |
|
The volume or remote file share has been added to the maximum number of shadow copy sets. The specified volume or remote file share was not added to the shadow copy set. |
|
The specified volume is nested too deeply to participate in the VSS operation. Possible reasons for this error include the following:
|
|
pwszVolumeName does not correspond to an existing volume or remote file share. |
|
ProviderId does not correspond to a registered provider. |
|
Expected provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS. |
|
Another shadow copy creation is already in progress. Occurs when adding a CSV volume to a snapshot set from multiple nodes at the same time, or while adding a scale out share to the snapshot set from multiple SMB client nodes at the same time. |
|
The value of the ProviderId parameter is GUID_NULL and no VSS provider indicates that it supports the specified volume or remote file share. |
|
The volume or remote file share is not supported by the specified provider. |
|
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. |
|
The provider returned an unexpected error code. This error code is only returned via the QueryStatus method on the IVssAsync interface returned in the ppAsync parameter. |
Remarks
Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XP and Windows Server 2003: Remote file shares are not supported until Windows 8 and Windows Server 2012.
If pwszVolumeName is a UNC share path, the server name portion must be in hostname or fully qualified domain name format. UNC share names with IP addresses must be normalized by calling the IVssBackupComponentsEx4::GetRootAndLogicalPrefixPaths method before they are passed to AddToSnapshotSet.
The maximum number of shadow copied volumes in a single shadow copy set is 64.
If ProviderId is GUID_NULL, the default provider is selected according to the following algorithm:
- If any hardware provider supports the given volume or remote file share, that provider is selected.
- If there is no hardware provider available, if any software provider supports the given volume, it is selected.
- If there is no hardware provider or software provider available, the system provider is selected. (There is only one preinstalled system provider, which must support all nonremovable local volumes.)
Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: VHDs are not supported.
The shadow copy identifier that is returned in the pidSnapshot parameter is stored in the Backup Components Document. However, there is no method for querying this information, and the caller may need to store it so that it can be used during restore.
Requirements
Requirement | Value |
---|---|
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 |