大网数据广告活动
Windows排障命令

attach vdisk

· 52CE 我爱测

Reference article for the attach vdisk command, which attaches (sometimes called mounts or surfaces) a virtual hard disk (VHD) so that it appears on the host computer as a local hard disk drive.

Attaches (sometimes called mounts or surfaces) a virtual hard disk (VHD) so that it appears on the host computer as a local hard disk drive. If the VHD already has a disk partition and file system volume when you attach it, the volume inside the VHD is assigned a drive letter.

Important: You must choose and detach a VHD for this operation to succeed. Use the select vdisk command to select a VHD and shift the focus to it.

Syntax

attach vdisk [readonly] { [sd=<SDDL>] | [usefilesd] } [noerr]

Parameters

Parameter Description
readonly Attaches the VHD as read-only. Any write operation returns an error.
sd=<SDDL string> Sets the user filter on the VHD. The filter string must be in the Security Descriptor Definition Language (SDDL) format. By default the user filter allows access like on a physical disk. SDDL strings can be complex, but in its simplest form, a security descriptor that protects access is known as a discretionary access control list (DACL). It uses the form: D:<dacl_flags><string_ace1><string_ace2>... <string_acen>Common DACL flags are:<ul><li>A. Allow access</li><li>D. Deny access</li></ul>Common rights are:<ul><li>GA. All access</li><li>GR. Read access</li><li> GW. Write access</li></ul>Common user accounts are:<ul><li>BA. Built in administrators</li><li>AU. Authenticated users</li><li>CO. Creator owner</li><li>WD. Everyone</li></ul>Examples:<ul><li>D:P:(A;;GR;;;AU. Gives read-access to all authenticated users.</li><li>D:P:(A;;GA;;;WD. Gives everyone full access.</li></ul>
usefilesd Specifies that the security descriptor on the .vhd file should be used on the VHD. If the Usefilesd parameter is not specified, the VHD will not have an explicit security descriptor unless it is specified with the Sd parameter.
noerr Used for scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Examples

To attach the selected VHD as read-only, type:

attach vdisk readonly

Related links

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). 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 Server documentation
适用范围
Windows Server · Source date 10/16/2017
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

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

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