Powershell 3.0 practice (3) Managing hyper-V 3.0 (2)

Source: Internet
Author: User

The last time I gave an overview of hyper-V 3.0 and added many new enterprise-level features, which deserves attention.

This time, we continue to focus on hyper-V 3.0 and test virtual hard disk management.

Test script download

All scripts in this series pass the Windows Server 8 (powershell ise x64) test.

 

1. Create a virtual hard disk

Create a virtual hard disk in vhd format, with a size of 10 GB and dynamic expansion

New-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhd
-Vhdtype
Dynamic
-Vhdformat
Vhd
-Sizebytes
10 GB

Execution result:

 

2. Convert vhd to vhdx format

Convert-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhd
-Destinationpath
F: \ work \ TMP \ hyper-V \ newvhd. vhdx
-Vhdformat
Vhdx

Execution result:

I thought that convert-vhd could convert vhdx to other virtual hard disk formats such as vmdk, VDI, HDD, and IMG. Well, it can only be converted between vhd and vhdx.

 

3. view basic information about a virtual hard disk

Get-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhdx

Execution result:

 

4. Mount and detach a virtual hard disk

Mount-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhdx

 

Dismount-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhdx

Execution result:

 

5. Test the virtual hard disk

Test-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhdx

Execution result:

 

6. Expand the virtual hard disk capacity

Resize-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhdx
-Sizebytes
20 GB

Execution result:

 

7. Optimize virtual hard disks

Optimize-vhd
-Path
F: \ work \ TMP \ hyper-V \ newvhd. vhdx
-Mode
Quick

Execution result:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.