PowerShell Logo Small

Set-VHD



This is the built-in help made by Microsoft for the command 'Set-VHD', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Set properties associated with a virtual hard disk.

SYNTAX


Set-VHD [-Path] <String> [-ParentPath] <String> [-ComputerName <String[]>] [-IgnoreIdMismatch] [-LeafPath <String>] [-Passthru] [-Confirm]
[-WhatIf] [<CommonParameters>]
Set-VHD [-Path] <String> [-ComputerName <String[]>] [-Passthru] -PhysicalSectorSizeBytes <UInt32> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-VHD cmdlet sets the ParentPath or PhysicalSectorSizeBytes properties of a virtual hard disk. The two properties must be set in
separate operations.



<

RELATED LINKS






REMARKS

<

Examples


Example 1

PS C:\>Set-VHD –Path Child1.vhd –ParentPath ParentCopy.vhd –LeafPath Child2.vhd



This example sets the parent of the virtual hard disk associated with ParentCopy.vhd as the parent of the chained virtual hard disk associated
with Child1.vhd, where the leaf of the virtual disk chain is the virtual hard disk associated with Child2.vhd. The operation is performed in
online mode.




Example 2

PS C:\>Set-VHD –Path Child1.vhd –ParentPath ParentCopy.vhd



This example sets the parent of the virtual hard disk associated with ParentCopy.vhd as the parent of the chained virtual hard disk associated
with Child1.vhd. This operation cannot be performed when the virtual disk chain is attached.




Example 3

PS C:\>Set-VHD -Path Child1.vhd -parentpath parentcopywithnewid.vhd -IgnoreMismatchId



This example sets the parent of Child1.vhd to point to parentcopywithnewid.vhd, even though parentcopywithnewid.vhd has a different ID than
the original parent of child1.vhd.
The operation is performed in offline mode. This mode should be used with extreme caution, and only when it is certain that the block contents
of the new and old parents are exactly the same. Otherwise data loss can occur.




Example 4

PS C:\> Set-VHD –Path c:\test.vhdx –PhysicalSectorSizeBytes 512



This example sets the physical sector size of a VHDX to 512 bytes.