大网数据广告活动
域与目录服务

DsRestorePrepare function (Ntdsbcli.h)

· 52CE 我爱测

Connects to the specified directory server and prepares it for the restore operation.

[This function is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Beginning with Windows Vista, use Volume Shadow Copy Service (VSS) instead.]

The DsRestorePrepare function connects to the specified directory server and prepares it for the restore operation.

Syntax

HRESULT DsRestorePrepare(
  _In_  LPCWSTR szServerName,
  _In_  ULONG   rtFlag,
  _In_  PVOID   pvExpiryToken,
  _In_  DWORD   cbExpiryTokenSize,
  _Out_ HBC     *phbc
);

Parameters

szServerName [in]

Pointer to a null-terminated string that contains the name of the server to restore. Preceding backslashes are optional. The server must be the same computer that this function is called from. The server name cannot contain any underscore (_) characters. An example of a server name is "\\server1".

rtFlag [in]

Specifies the type of restoration to perform. This can be zero or one of the following values.

RESTORE_TYPE_CATCHUP

Default. The restored version is reconciled through the standard reconciliation logic so that the restored DIT can synchronize with other enterprise server computers.

RESTORE_TYPE_AUTHORATATIVE

Not Supported.

RESTORE_TYPE_ONLINE

Not Supported. Restoration is performed when NTDS is online.

pvExpiryToken [in]

Pointer to the expiry token associated with the backup being restored. This token was obtained from the DsBackupPrepare function when the directory was backed up.

If this parameter is NULL, the handle returned in phbc can only be used to obtain the restoration directories with the DsRestoreGetDatabaseLocations function. The handle cannot be used for any other restoration functions.

cbExpiryTokenSize [in]

Contains the size, in bytes, of the expiry token in pvExpiryToken.

phbc [out]

Pointer to an HBC value that receives the handle for the restore. This handle is used when calling other Directory Service restore functions, such as DsBackupOpenFile and DsRestoreEnd.

Return value

If successful, returns a standard HRESULT codes; otherwise, a failure code is returned.

Remarks

The DsRestorePrepare function requires that the caller is a member of the Administrators group on the server.

DsRestorePrepare may be used with or without a token provided. If the token is provided, it is checked for expiration, and all operations are allowed on the context returned. If the token is not provided, the context returned is restricted, and may be used only for the DsRestoreGetDatabaseLocations function. It may not be used for the DsRestoreRegister function.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header Ntdsbcli.h
Library Ntdsbcli.lib
DLL Ntdsbcli.dll
Unicode and ANSI names DsRestorePrepareW (Unicode) and DsRestorePrepareA (ANSI)

See also

Restoring an Active Directory Server

Directory Backup Functions

DsRestoreGetDatabaseLocations

DsRestoreRegister

DsRestoreRegisterComplete

DsRestoreEnd

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。